summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/float_compare.py
blob: c177aa7e81d52be8ebea2bc796f5cf8e52d14267 (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
# Extended float comparisons


class Foo:
    pass


foo = Foo()

print(foo == 1.0)
print(1.0 == foo)
print(1.0 == Foo)
print(1.0 == [])
print(1.0 == {})

try:
    print(foo < 1.0)
except TypeError:
    print("TypeError")

try:
    print(1.0 < foo)
except TypeError:
    print("TypeError")