diff options
author | Shane Harvey <shane.harvey@mongodb.com> | 2017-08-04 08:45:00 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-08-04 08:45:00 (GMT) |
commit | c4c9866064f03646c686d7e08b00aeb203c35c19 (patch) | |
tree | 9af64a872544117d7a3f41469b3018555c18e213 /Lib/test | |
parent | 778928b0c7aa438c282727535814d73df850693a (diff) | |
download | cpython-c4c9866064f03646c686d7e08b00aeb203c35c19.zip cpython-c4c9866064f03646c686d7e08b00aeb203c35c19.tar.gz cpython-c4c9866064f03646c686d7e08b00aeb203c35c19.tar.bz2 |
bpo-31107: Fix copyreg mangled slot names calculation. (#2989)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_copyreg.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_copyreg.py b/Lib/test/test_copyreg.py index 52e887c..e3f1cd8 100644 --- a/Lib/test/test_copyreg.py +++ b/Lib/test/test_copyreg.py @@ -16,6 +16,12 @@ class WithWeakref(object): class WithPrivate(object): __slots__ = ('__spam',) +class _WithLeadingUnderscoreAndPrivate(object): + __slots__ = ('__spam',) + +class ___(object): + __slots__ = ('__spam',) + class WithSingleString(object): __slots__ = 'spam' @@ -104,6 +110,10 @@ class CopyRegTestCase(unittest.TestCase): self.assertEqual(copyreg._slotnames(WithWeakref), []) expected = ['_WithPrivate__spam'] self.assertEqual(copyreg._slotnames(WithPrivate), expected) + expected = ['_WithLeadingUnderscoreAndPrivate__spam'] + self.assertEqual(copyreg._slotnames(_WithLeadingUnderscoreAndPrivate), + expected) + self.assertEqual(copyreg._slotnames(___), ['__spam']) self.assertEqual(copyreg._slotnames(WithSingleString), ['spam']) expected = ['eggs', 'spam'] expected.sort() |