• Home
  • Raw
  • Download

Lines Matching +full:test +full:- +full:suite +full:- +full:vm

5 from test import support
6 from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
39 self.assertEqual(int(-3.14), -3)
41 self.assertEqual(int(-3.9), -3)
43 self.assertEqual(int(-3.5), -3)
44 self.assertEqual(int("-3"), -3)
45 self.assertEqual(int(" -3 "), -3)
46 self.assertEqual(int("\N{EM SPACE}-3\N{EN SPACE}"), -3)
49 # Test conversion from strings and various anomalies
51 for sign in "", "+", "-":
55 if sign == "-" and v is not ValueError:
56 vv = -v
62 s = repr(-1-sys.maxsize)
64 self.assertEqual(x+1, -sys.maxsize)
72 x = int(-1e100)
79 x = -1-sys.maxsize
224 int('-')
226 int('- 1')
248 # Additional test cases with bases != 0, only for the constructor:
261 self.assertIs(int('-1'), -1)
263 self.assertIs(int(b'-1'), -1)
269 # Test invoking int() using keyword arguments.
286 int('0', -909) # An old magic value base from Python 2.
288 int('0', base=0-(2**234))
310 for base in 2**100, -2**100, 1, 37:
314 # Check in-range bases.
320 # Test possible non-numeric types for the argument x, including
348 msg = "can't convert non-string"
365 # Test __int__()
387 return -12
437 "__trunc__ returned non-Integral"
443 # Regression test for bugs.python.org/issue16060.
586 # non-UTF-8 byte string
603 int_class = int # Override this in subclasses to reuse the suite.
624 """Ignore the +/- sign and space padding."""
632 int_class('-' + '1' * maxdigits)
633 self.assertEqual(len(str(10 ** (maxdigits - 1))), maxdigits)
649 self.check('-' + '1' * (maxdigits + 1))
657 """Regression test: ensure we fail before performing O(N**2) work."""
659 assert maxdigits < 50_000, maxdigits # A test prerequisite.
669 seconds_to_convert = get_time() - start
672 # It takes 0.1 seconds on a Zen based cloud VM in an opt build.
678 # We test with the limit almost at the size needed to check performance.
684 seconds_to_fail_huge = get_time() - start
688 # Now we test that a conversion that would take 30x as long also fails
693 # If not limited, 8 seconds said Zen based cloud VM.
695 seconds_to_fail_extra_huge = get_time() - start
700 """Regression test: ensure we fail before performing O(N**2) work."""
702 assert maxdigits < 100_000, maxdigits # A test prerequisite.
712 seconds_to_convert = get_time() - start
714 # It takes 0.1 seconds on a Zen based cloud VM in an opt build.
720 with support.adjust_int_max_str_digits(digits - 1):
724 seconds_to_fail_huge = get_time() - start
728 # Now we test that a conversion that would take 30x as long also fails
733 # If not limited, 8 seconds in the Zen based cloud VM.
735 seconds_to_fail_extra_huge = get_time() - start
767 neg_i = int_class(f'-{s}')
768 assert -pos_i == neg_i