py/objarray: Implement more/less comparisons for array.

This commit is contained in:
stijn
2021-05-10 16:40:51 +02:00
committed by Damien George
parent 57365d8557
commit 09be0c083c
3 changed files with 53 additions and 5 deletions

View File

@@ -27,6 +27,26 @@ print(bytearray([1]) == b"1")
print(b"1" == bytearray([1]))
print(bytearray() == bytearray())
b1 = bytearray([1, 2, 3])
b2 = bytearray([1, 2, 3])
b3 = bytearray([1, 3])
print(b1 == b2)
print(b2 != b3)
print(b1 <= b2)
print(b1 <= b3)
print(b1 < b3)
print(b1 >= b2)
print(b3 >= b2)
print(b3 > b2)
print(b1 != b2)
print(b2 == b3)
print(b1 > b2)
print(b1 > b3)
print(b1 >= b3)
print(b1 < b2)
print(b3 < b2)
print(b3 <= b2)
# comparison with other type should return False
print(bytearray() == 1)