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