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.
This commit is contained in:
Damien George
2020-02-10 22:22:12 +11:00
parent 9ec1caf42e
commit 27465e6b24
6 changed files with 80 additions and 0 deletions

View File

@@ -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