mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
py/objarray: Implement more/less comparisons for array.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user