Last active
December 17, 2015 17:09
-
-
Save aglyzov/5643563 to your computer and use it in GitHub Desktop.
A bug in plyvel 0.2 -- reverse iterators with prefix are badly broken
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
import plyvel | |
db = plyvel.DB('/tmp/test-reverse-iterator.db', create_if_missing=True) | |
db.put(b'aaa', b'1') | |
db.put(b'bbb', b'2') | |
# these pass: | |
assert list(db.iterator(reverse=True)) == [(b'bbb', b'2'), (b'aaa', b'1')] | |
assert list(db.iterator(prefix=b'b')) == [(b'bbb', b'2')] | |
assert list(db.iterator(prefix=b'c')) == [] | |
assert list(db.prefixed_db(b'c').iterator()) == [] | |
# these fail: | |
assert list(db.iterator(prefix=b'c', reverse=True)) == [] | |
assert list(db.prefixed_db(b'c').iterator(reverse=True)) == [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See wbolster/plyvel#9 for the accompanying bug report.