summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/special_comparisons2.py
blob: c29dc72ce60c0ae58a947ffbee930bab9e0c3d84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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())