linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / funcsigs / fix-pypy3-tests.patch
blobf4ecec3b6137dbb37b7aff2296a8cbd01abea1fc
1 diff --git a/tests/test_inspect.py b/tests/test_inspect.py
2 index 98d6592..3a2a1f2 100644
3 --- a/tests/test_inspect.py
4 +++ b/tests/test_inspect.py
5 @@ -8,6 +8,7 @@ import unittest2 as unittest
7 import funcsigs as inspect
9 +import platform
11 class TestSignatureObject(unittest.TestCase):
12 @staticmethod
13 @@ -409,7 +410,7 @@ def test_signature_on_decorated(self):
14 Ellipsis))
15 """)
17 - if sys.version_info[0] > 2:
18 + if sys.version_info[0] > 2 and platform.python_implementation() != "PyPy":
19 exec("""
20 def test_signature_on_class(self):
21 class C:
22 @@ -493,41 +494,44 @@ def test_signature_on_class(self):
23 Ellipsis))
24 """)
26 - def test_signature_on_callable_objects(self):
27 - class Foo(object):
28 - def __call__(self, a):
29 - pass
30 + if platform.python_implementation() != "PyPy":
31 + exec("""
32 +def test_signature_on_callable_objects(self):
33 + class Foo(object):
34 + def __call__(self, a):
35 + pass
37 - self.assertEqual(self.signature(Foo()),
38 - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
39 - Ellipsis))
40 + self.assertEqual(self.signature(Foo()),
41 + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
42 + Ellipsis))
44 - class Spam(object):
45 - pass
46 - with self.assertRaisesRegex(TypeError, "is not a callable object"):
47 - inspect.signature(Spam())
48 + class Spam(object):
49 + pass
50 + with self.assertRaisesRegex(TypeError, "is not a callable object"):
51 + inspect.signature(Spam())
53 - class Bar(Spam, Foo):
54 - pass
55 + class Bar(Spam, Foo):
56 + pass
58 - self.assertEqual(self.signature(Bar()),
59 - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
60 - Ellipsis))
61 + self.assertEqual(self.signature(Bar()),
62 + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
63 + Ellipsis))
65 - class ToFail(object):
66 - __call__ = type
67 - with self.assertRaisesRegex(ValueError, "not supported by signature"):
68 - inspect.signature(ToFail())
69 + class ToFail(object):
70 + __call__ = type
71 + with self.assertRaisesRegex(ValueError, "not supported by signature"):
72 + inspect.signature(ToFail())
74 - if sys.version_info[0] < 3:
75 - return
76 + if sys.version_info[0] < 3:
77 + return
79 - class Wrapped(object):
80 - pass
81 - Wrapped.__wrapped__ = lambda a: None
82 - self.assertEqual(self.signature(Wrapped),
83 - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
84 - Ellipsis))
85 + class Wrapped(object):
86 + pass
87 + Wrapped.__wrapped__ = lambda a: None
88 + self.assertEqual(self.signature(Wrapped),
89 + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
90 + Ellipsis))
91 +""")
93 def test_signature_on_lambdas(self):
94 self.assertEqual(self.signature((lambda a=10: a)),