diff options
| author | Damien George | 2020-02-10 22:22:12 +1100 |
|---|---|---|
| committer | Damien George | 2020-02-11 11:06:17 +1100 |
| commit | 27465e6b24e80fdcdaddd015fe8f690122f78ef8 (patch) | |
| tree | 5bc93de146462c95e47eaa4374df6195e97d5e8e /tests/float | |
| parent | 9ec1caf42e7733b5141b7aecf1b6e58834a94bf7 (diff) | |
tests/basics: Add tests for equality between bool and int/float/complex.
False/True should be implicitly converted to 0/1 when compared with numeric
types.
Diffstat (limited to 'tests/float')
| -rw-r--r-- | tests/float/complex1.py | 2 | ||||
| -rw-r--r-- | tests/float/float1.py | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/float/complex1.py b/tests/float/complex1.py index 479b4b348..c1fa61ba3 100644 --- a/tests/float/complex1.py +++ b/tests/float/complex1.py @@ -36,6 +36,8 @@ ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) # comparison print(1j == 1) print(1j == 1j) +print(0 + 0j == False, 1 + 0j == True) +print(False == 0 + 0j, True == 1 + 0j) # comparison of nan is special nan = float('nan') * 1j diff --git a/tests/float/float1.py b/tests/float/float1.py index 54807e5ac..f6d69e390 100644 --- a/tests/float/float1.py +++ b/tests/float/float1.py @@ -64,6 +64,8 @@ print(1.2 <= 3.4) print(1.2 <= -3.4) print(1.2 >= 3.4) print(1.2 >= -3.4) +print(0.0 == False, 1.0 == True) +print(False == 0.0, True == 1.0) # comparison of nan is special nan = float('nan') |
