aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Rivera <stefano@rivera.za.net>2020-10-05 20:34:12 -0700
committerStefano Rivera <stefano@rivera.za.net>2020-10-05 20:34:12 -0700
commit329fe9298501ada43b725e07bdf4dafcb94fed8d (patch)
tree1fed7cebb74c5a603db9be4d0a485647c3a3938e /lib-python
parentHandle PyPy's magic offset from cPython (bpo-29514) (diff)
downloadpypy-329fe9298501ada43b725e07bdf4dafcb94fed8d.tar.gz
pypy-329fe9298501ada43b725e07bdf4dafcb94fed8d.tar.bz2
pypy-329fe9298501ada43b725e07bdf4dafcb94fed8d.zip
Reapply c8d93fa469ba, dropped in d147d3b422d7
> Fix the cpython test for newer pypy versions, with a comment
Diffstat (limited to 'lib-python')
-rw-r--r--lib-python/2.7/test/test_inspect.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib-python/2.7/test/test_inspect.py b/lib-python/2.7/test/test_inspect.py
index 1f94e68635..daed32cbd8 100644
--- a/lib-python/2.7/test/test_inspect.py
+++ b/lib-python/2.7/test/test_inspect.py
@@ -47,6 +47,9 @@ except:
git = mod.StupidGit()
+class ExampleClassWithSlot(object):
+ __slots__ = 'myslot'
+
class IsTestBase(unittest.TestCase):
predicates = set([inspect.isbuiltin, inspect.isclass, inspect.iscode,
inspect.isframe, inspect.isfunction, inspect.ismethod,
@@ -98,7 +101,11 @@ class TestPredicates(IsTestBase):
else:
self.assertFalse(inspect.isgetsetdescriptor(type(tb.tb_frame).f_locals))
if hasattr(types, 'MemberDescriptorType'):
- self.istest(inspect.ismemberdescriptor, 'datetime.timedelta.days')
+ # App-level slots are member descriptors on both PyPy and
+ # CPython, but the various built-in attributes are all
+ # getsetdescriptors on PyPy. So check ismemberdescriptor()
+ # with an app-level slot.
+ self.istest(inspect.ismemberdescriptor, 'ExampleClassWithSlot.myslot')
else:
self.assertFalse(inspect.ismemberdescriptor(datetime.timedelta.days))