Skip to content

Commit 617d952

Browse files
committed
Add special method test
1 parent 007e714 commit 617d952

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

mypyc/test-data/run-signatures.test

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,26 +104,29 @@ class Foo:
104104
def f2(cls, x): pass
105105
@staticmethod
106106
def f3(x): pass
107+
def __eq__(self, x: object): pass
107108

108109
def test_methods() -> None:
109110
assert getattr(Foo.f1, "__text_signature__") == "($self, x)"
110-
assert str(inspect.signature(Foo.f1)) == "(self, /, x)"
111-
112-
assert getattr(Foo.f2, "__text_signature__") == "($cls, x)"
113-
assert str(inspect.signature(Foo.f2)) == "(x)"
114-
115-
assert getattr(Foo.f3, "__text_signature__") == "(x)"
116-
assert str(inspect.signature(Foo.f3)) == "(x)"
117-
118111
assert getattr(Foo().f1, "__text_signature__") == "($self, x)"
112+
assert str(inspect.signature(Foo.f1)) == "(self, /, x)"
119113
assert str(inspect.signature(Foo().f1)) == "(x)"
120114

115+
assert getattr(Foo.f2, "__text_signature__") == "($cls, x)"
121116
assert getattr(Foo().f2, "__text_signature__") == "($cls, x)"
117+
assert str(inspect.signature(Foo.f2)) == "(x)"
122118
assert str(inspect.signature(Foo().f2)) == "(x)"
123119

120+
assert getattr(Foo.f3, "__text_signature__") == "(x)"
124121
assert getattr(Foo().f3, "__text_signature__") == "(x)"
122+
assert str(inspect.signature(Foo.f3)) == "(x)"
125123
assert str(inspect.signature(Foo().f3)) == "(x)"
126124

125+
assert getattr(Foo.__eq__, "__text_signature__") == "($self, value, /)"
126+
assert getattr(Foo().__eq__, "__text_signature__") == "($self, value, /)"
127+
assert str(inspect.signature(Foo.__eq__)) == "(self, value, /)"
128+
assert str(inspect.signature(Foo().__eq__)) == "(value, /)"
129+
127130
[case testSignaturesHistoricalPositionalOnly]
128131
import inspect
129132

0 commit comments

Comments
 (0)