Skip to content

Commit ecf2624

Browse files
committed
Introduce run-dunders-special.test
1 parent 9b8d56e commit ecf2624

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[case testDundersNotImplemented]
2+
# This case is special because it tests the behavior of NotImplemented
3+
# used in a typed function which return type is bool.
4+
# This is a convention that can be overriden by the user.
5+
class UsesNotImplemented:
6+
def __eq__(self, b: object) -> bool:
7+
return NotImplemented
8+
9+
assert UsesNotImplemented() != object()

mypyc/test-data/run-dunders.test

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ class BoxedThing:
3232
class Subclass2(BoxedThing):
3333
pass
3434

35-
class UsesNotImplemented:
36-
def __eq__(self, b: object) -> bool:
37-
return NotImplemented
38-
3935
def index_into(x : Any, y : Any) -> Any:
4036
return x[y]
4137

@@ -81,8 +77,6 @@ assert is_truthy(Item('a'))
8177
assert not is_truthy(Subclass1(''))
8278
assert is_truthy(Subclass1('a'))
8379

84-
assert UsesNotImplemented() != object()
85-
8680
internal_index_into()
8781
[out]
8882
7 7

mypyc/test/test_run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"run-bench.test",
6464
"run-mypy-sim.test",
6565
"run-dunders.test",
66+
"run-dunders-special.test",
6667
"run-singledispatch.test",
6768
"run-attrs.test",
6869
"run-python37.test",

0 commit comments

Comments
 (0)