circuitpython/tests/basics/equal_class.py
Damien George c38dc3ccc7 py: Implement fallback for equality check for all types.
Return "not equal" for objects that don't implement equality check.
This is as per Python specs.
2015-01-11 15:13:18 +00:00

26 lines
295 B
Python

# test equality for classes/instances to other types
class A:
pass
class B:
pass
class C(A):
pass
print(A == None)
print(None == A)
print(A == A)
print(A() == A)
print(A() == A())
print(A == B)
print(A() == B)
print(A() == B())
print(A == C)
print(A() == C)
print(A() == C())