diff options
Diffstat (limited to 'tests/float/float_compare.py')
-rw-r--r-- | tests/float/float_compare.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/float/float_compare.py b/tests/float/float_compare.py new file mode 100644 index 0000000000..105923ac73 --- /dev/null +++ b/tests/float/float_compare.py @@ -0,0 +1,22 @@ +# 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") |