diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-29 18:13:56 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-29 18:13:56 (GMT) |
| commit | 43e9007767618aac7d6c30228518ae375ebb3008 (patch) | |
| tree | 2c4ab8dd74122efa80461a0003ce28c9fa7e69ed /Lib/test/test_int.py | |
| parent | 81772f1ee2d80b02e882e1132d5751fe0852e023 (diff) | |
| download | cpython-43e9007767618aac7d6c30228518ae375ebb3008.zip cpython-43e9007767618aac7d6c30228518ae375ebb3008.tar.gz cpython-43e9007767618aac7d6c30228518ae375ebb3008.tar.bz2 | |
Fixed Py3k warnings in tests for issue #24731.
Diffstat (limited to 'Lib/test/test_int.py')
| -rw-r--r-- | Lib/test/test_int.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index 0dd8efc..ea5c0e3 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -351,7 +351,8 @@ class IntTestCases(IntLongCommonTests, unittest.TestCase): factories += [unicode, CustomUnicode] for f in factories: - x = f('100') + with test_support.check_py3k_warnings(quiet=True): + x = f('100') msg = 'x has value %s and type %s' % (x, type(x).__name__) try: self.assertEqual(int(x), 100, msg=msg) @@ -365,15 +366,17 @@ class IntTestCases(IntLongCommonTests, unittest.TestCase): with self.assertRaisesRegexp(TypeError, errmsg, msg=msg): int(x, 2) errmsg = 'invalid literal' - with self.assertRaisesRegexp(ValueError, errmsg, msg=msg): + with self.assertRaisesRegexp(ValueError, errmsg, msg=msg), \ + test_support.check_py3k_warnings(quiet=True): int(f('A' * 0x10)) def test_int_buffer(self): - self.assertEqual(int(buffer('123', 1, 2)), 23) - self.assertEqual(int(buffer('123\x00', 1, 2)), 23) - self.assertEqual(int(buffer('123 ', 1, 2)), 23) - self.assertEqual(int(buffer('123A', 1, 2)), 23) - self.assertEqual(int(buffer('1234', 1, 2)), 23) + with test_support.check_py3k_warnings(): + self.assertEqual(int(buffer('123', 1, 2)), 23) + self.assertEqual(int(buffer('123\x00', 1, 2)), 23) + self.assertEqual(int(buffer('123 ', 1, 2)), 23) + self.assertEqual(int(buffer('123A', 1, 2)), 23) + self.assertEqual(int(buffer('1234', 1, 2)), 23) def test_error_on_string_float_for_x(self): self.assertRaises(ValueError, int, '1.2') |
