diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-10 22:22:12 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-11 11:06:17 +1100 |
commit | 27465e6b24e80fdcdaddd015fe8f690122f78ef8 (patch) | |
tree | 5bc93de146462c95e47eaa4374df6195e97d5e8e /tests/basics/bool1.py | |
parent | 9ec1caf42e7733b5141b7aecf1b6e58834a94bf7 (diff) | |
download | micropython-27465e6b24e80fdcdaddd015fe8f690122f78ef8.tar.gz micropython-27465e6b24e80fdcdaddd015fe8f690122f78ef8.zip |
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/basics/bool1.py')
-rw-r--r-- | tests/basics/bool1.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/basics/bool1.py b/tests/basics/bool1.py index 35d9ed8ccc..daabfb17d8 100644 --- a/tests/basics/bool1.py +++ b/tests/basics/bool1.py @@ -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) |