Debian Codegraph @

mypyc/test-data/run-dunders-special.test

raw
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 overridden by the user.
5 class UsesNotImplemented:
6 def __eq__(self, b: object) -> bool:
7 return NotImplemented
8
9 def test_not_implemented() -> None:
10 assert UsesNotImplemented() != object()
11 x = UsesNotImplemented() == object()
12 assert not x