mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user