Skip to content
Snippets Groups Projects
Commit 06d68984 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

added extra comparison operators for `VarlenEntry`

parent 320480b7
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,7 @@ Consult the docs for how to disable it.
## v0.6.4
* fixed a bug with slicing chunks
* added extra comparison operators for `VarlenEntry`
## v0.6.3
......
......@@ -91,9 +91,15 @@ cdef class VarlenEntry:
def __gt__(self, other) -> bool:
return self.to_bytes() > other
def __le__(self, other) -> bool:
def __ge__(self, other) -> bool:
return self.to_bytes() >= other
def __lt__(self, other) -> bool:
return self.to_bytes() < other
def __le__(self, other) -> bool:
return self.to_bytes() <= other
def __eq__(self, other) -> bool:
return self.to_bytes() == other
......
......@@ -34,6 +34,11 @@ class TestVarlen(unittest.TestCase):
with varlen.iterate_range(0, 20) as iterator:
ve = iterator.get_next()
while ve is not None:
self.assertGreater(ve, b'tes')
self.assertLess(ve, b'tez')
self.assertGreaterEqual(ve, b'tes')
self.assertLessEqual(ve, b'tez')
hash(ve)
self.assertTrue(ve.slice(0, 4), b'test')
self.assertTrue(ve.startswith(b'test '))
# self.assertTrue(ve.endswith(b'skarabeusza'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment