Lines Matching refs:base

47         # Different base:
101 # SF bug 1334662: int(string, base) wrong answers
141 # tests with base 0
155 # without base still base 10
159 # tests with prefix and base != 0
182 # SF bug 1334662: int(string, base) wrong answers
270 self.assertEqual(int('100', base=2), 4)
274 int(x='100', base=2)
275 self.assertRaises(TypeError, int, base=10)
276 self.assertRaises(TypeError, int, base=0)
279 """Testing the supported limits of the int() base parameter."""
286 int('0', -909) # An old magic value base from Python 2.
288 int('0', base=0-(2**234))
290 int('0', base=2**234)
292 for base in range(2,37):
293 self.assertEqual(int('0', base=base), 0)
310 for base in 2**100, -2**100, 1, 37:
312 int('43', base)
315 self.assertEqual(int('101', base=MyIndexable(2)), 5)
316 self.assertEqual(int('101', base=MyIndexable(10)), 101)
317 self.assertEqual(int('101', base=MyIndexable(36)), 1 + 36**2)
382 for base in (object, Classic):
383 class IntOverridesTrunc(base):
390 class JustTrunc(base):
396 class ExceptionalTrunc(base):
408 class TruncReturnsNonInt(base):
418 class TruncReturnsNonIndex(base):
429 class TruncReturnsNonIntegral(base):
441 ((base, trunc_result_base),))
448 class TruncReturnsBadInt(base):
561 def check(s, base=None):
563 msg="int(%r, %r)" % (s, base)) as cm:
564 if base is None:
567 int(s, base)
569 "invalid literal for int() with base %d: %r" %
570 (10 if base is None else base, s))
577 # SF bug 1545497: embedded NULs were not detected with explicit base
635 def check(self, i, base=None):
637 if base is None:
640 self.int_class(i, base)
664 huge_int = int(f'0x{"c"*65_000}', base=16) # 78268 decimal digits.
690 extra_huge_int = int(f'0x{"c"*500_000}', base=16) # 602060 digits.
743 for base in (2, 4, 8, 16, 32):
744 with self.subTest(base=base):
745 self.int_class('1' * (maxdigits + 1), base)
747 self.int_class('1' * 100_000, base)
772 def _other_base_helper(self, base):
776 i = int_class(s, base)
777 if base > 10:
780 elif base < 10:
783 int_class(f'{s}1', base)
786 base = 3
787 with self.subTest(base=base):
788 self._other_base_helper(base)
789 base = 36
790 with self.subTest(base=base):
791 self._other_base_helper(base)