diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-22 09:14:52 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-22 09:14:52 (GMT) |
commit | 0c937b3ed6d2eeca84fa4aca1a9aef685db65abc (patch) | |
tree | f5691e459361ce03018098bbad26f9472e8340e5 /Lib/test | |
parent | fbc877b7940beaa23fea020b8a137a660eff419e (diff) | |
download | cpython-0c937b3ed6d2eeca84fa4aca1a9aef685db65abc.zip cpython-0c937b3ed6d2eeca84fa4aca1a9aef685db65abc.tar.gz cpython-0c937b3ed6d2eeca84fa4aca1a9aef685db65abc.tar.bz2 |
Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix
when contain an id in form " at 0x...".
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_reprlib.py | 2 | ||||
-rw-r--r-- | Lib/test/test_weakref.py | 8 | ||||
-rw-r--r-- | Lib/test/test_xmlrpc.py | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py index ae67f06..d65494a 100644 --- a/Lib/test/test_reprlib.py +++ b/Lib/test/test_reprlib.py @@ -123,7 +123,7 @@ class ReprTests(unittest.TestCase): eq(r(i2), expected) i3 = ClassWithFailingRepr() - eq(r(i3), ("<ClassWithFailingRepr instance at %x>"%id(i3))) + eq(r(i3), ("<ClassWithFailingRepr instance at %#x>"%id(i3))) s = r(ClassWithFailingRepr) self.assertTrue(s.startswith("<class ")) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index cccb515..adb923f 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1536,6 +1536,14 @@ class MappingTestCase(TestBase): self.assertEqual(len(d), 0) self.assertEqual(count, 2) + def test_make_weak_valued_dict_repr(self): + dict = weakref.WeakValueDictionary() + self.assertRegex(repr(dict), '<WeakValueDictionary at 0x.*>') + + def test_make_weak_keyed_dict_repr(self): + dict = weakref.WeakKeyDictionary() + self.assertRegex(repr(dict), '<WeakKeyDictionary at 0x.*>') + from test import mapping_tests class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 120c54f..c184da3 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -287,7 +287,7 @@ class DateTimeTestCase(unittest.TestCase): def test_repr(self): d = datetime.datetime(2007,1,2,3,4,5) t = xmlrpclib.DateTime(d) - val ="<DateTime '20070102T03:04:05' at %x>" % id(t) + val ="<DateTime '20070102T03:04:05' at %#x>" % id(t) self.assertEqual(repr(t), val) def test_decode(self): |