circuitpython/tests/basics/special_comparisons2.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
552 B
Python
Raw Normal View History

class E:
def __repr__(self):
return "E"
def __eq__(self, other):
print('E eq', other)
return 123
class F:
def __repr__(self):
return "F"
def __ne__(self, other):
print('F ne', other)
return -456
print(E() != F())
print(F() != E())
tests = (None, 0, 1, 'a')
for val in tests:
print('==== testing', val)
print(E() == val)
print(val == E())
print(E() != val)
print(val != E())
print(F() == val)
print(val == F())
print(F() != val)
print(val != F())