micropython

Annotated tests/compare_equality.py

634:c1c95a183e21
2013-01-14 Paul Boddie Moved common logic into a separate method.
paul@232 1
#!/usr/bin/env python
paul@232 2
paul@232 3
a = 1
paul@232 4
b = 2
paul@232 5
paul@232 6
class X:
paul@354 7
    def __eq__(self, other):
paul@354 8
        return 0
paul@354 9
    def __ne__(self, other):
paul@232 10
        return 1
paul@232 11
paul@232 12
x = X()
paul@232 13
paul@232 14
result_1 = 0
paul@232 15
result_2 = 2
paul@354 16
result_3 = 3
paul@432 17
result_4 = 0
paul@232 18
paul@232 19
if a != x != b:
paul@232 20
    result_1 = 1
paul@232 21
paul@232 22
if a == x != b:
paul@232 23
    result_2 = 0
paul@232 24
paul@354 25
if a == x:
paul@354 26
    result_3 = 0
paul@354 27
paul@432 28
if a != x:
paul@432 29
    result_4 = 4
paul@432 30
paul@232 31
# vim: tabstop=4 expandtab shiftwidth=4