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

@@ -10,6 +10,30 @@ print(False or True)
print(+True)
print(-True)
# comparison with itself
print(False == False)
print(False == True)
print(True == False)
print(True == True)
print(False != False)
print(False != True)
print(True != False)
print(True != True)
# comparison with integers
print(False == 0)
print(0 == False)
print(True == 1)
print(1 == True)
print(True == 2)
print(2 == True)
print(False != 0)
print(0 != False)
print(True != 1)
print(1 != True)
print(True != 2)
print(2 != True)
# unsupported unary op
try:
len(False)