summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorShane Harvey <shane.harvey@mongodb.com>2017-08-05 15:01:10 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-08-05 15:01:10 (GMT)
commit4795ba857ef2a89e6b477285df961672106a1792 (patch)
tree7fcf4caf59fc962aa7171c43878f687fc6916a1e /Lib/test
parenta0cb7db8e4b928b4c06da4bde8695555276958f0 (diff)
downloadcpython-4795ba857ef2a89e6b477285df961672106a1792.zip
cpython-4795ba857ef2a89e6b477285df961672106a1792.tar.gz
cpython-4795ba857ef2a89e6b477285df961672106a1792.tar.bz2
[3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (#3003)
(cherry picked from commit c4c9866064f03646c686d7e08b00aeb203c35c19)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_copyreg.py10
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()