|
25 | 25 | ThreadPoolExecutor = None
|
26 | 26 |
|
27 | 27 | from test.support import run_unittest, TESTFN, DirsOnSysPath, cpython_only
|
28 |
| -from test.support import MISSING_C_DOCSTRINGS, cpython_only |
| 28 | +from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ |
29 | 29 | from test.support.script_helper import assert_python_ok, assert_python_failure
|
30 | 30 | from test import inspect_fodder as mod
|
31 | 31 | from test import inspect_fodder2 as mod2
|
@@ -118,10 +118,6 @@ def gen_coroutine_function_example(self):
|
118 | 118 | yield
|
119 | 119 | return 'spam'
|
120 | 120 |
|
121 |
| -class EqualsToAll: |
122 |
| - def __eq__(self, other): |
123 |
| - return True |
124 |
| - |
125 | 121 | class TestPredicates(IsTestBase):
|
126 | 122 |
|
127 | 123 | def test_excluding_predicates(self):
|
@@ -2978,8 +2974,8 @@ def test_signature_equality(self):
|
2978 | 2974 | def foo(a, *, b:int) -> float: pass
|
2979 | 2975 | self.assertFalse(inspect.signature(foo) == 42)
|
2980 | 2976 | self.assertTrue(inspect.signature(foo) != 42)
|
2981 |
| - self.assertTrue(inspect.signature(foo) == EqualsToAll()) |
2982 |
| - self.assertFalse(inspect.signature(foo) != EqualsToAll()) |
| 2977 | + self.assertTrue(inspect.signature(foo) == ALWAYS_EQ) |
| 2978 | + self.assertFalse(inspect.signature(foo) != ALWAYS_EQ) |
2983 | 2979 |
|
2984 | 2980 | def bar(a, *, b:int) -> float: pass
|
2985 | 2981 | self.assertTrue(inspect.signature(foo) == inspect.signature(bar))
|
@@ -3246,8 +3242,8 @@ def test_signature_parameter_equality(self):
|
3246 | 3242 | self.assertFalse(p != p)
|
3247 | 3243 | self.assertFalse(p == 42)
|
3248 | 3244 | self.assertTrue(p != 42)
|
3249 |
| - self.assertTrue(p == EqualsToAll()) |
3250 |
| - self.assertFalse(p != EqualsToAll()) |
| 3245 | + self.assertTrue(p == ALWAYS_EQ) |
| 3246 | + self.assertFalse(p != ALWAYS_EQ) |
3251 | 3247 |
|
3252 | 3248 | self.assertTrue(p == P('foo', default=42,
|
3253 | 3249 | kind=inspect.Parameter.KEYWORD_ONLY))
|
@@ -3584,8 +3580,8 @@ def foo(a): pass
|
3584 | 3580 | ba = inspect.signature(foo).bind(1)
|
3585 | 3581 | self.assertTrue(ba == ba)
|
3586 | 3582 | self.assertFalse(ba != ba)
|
3587 |
| - self.assertTrue(ba == EqualsToAll()) |
3588 |
| - self.assertFalse(ba != EqualsToAll()) |
| 3583 | + self.assertTrue(ba == ALWAYS_EQ) |
| 3584 | + self.assertFalse(ba != ALWAYS_EQ) |
3589 | 3585 |
|
3590 | 3586 | ba2 = inspect.signature(foo).bind(1)
|
3591 | 3587 | self.assertTrue(ba == ba2)
|
|
0 commit comments