Permalink
Browse files

Add failing iterator tests for out of range start/stop keys

See issue #4.
  • Loading branch information...
1 parent be41341 commit 1e138340908e6d210b75bde8a3e779e12cfa7b98 @wbolster committed Mar 6, 2013
Showing with 25 additions and 0 deletions.
  1. +25 −0 test/test_plyvel.py
View
@@ -514,6 +514,31 @@ def test_reverse_range_iteration():
expected_values=(b'3', b'2', b'1'))
+def test_out_of_range_iterations():
+ with tmp_db('out_of_range_iterations') as db:
+ db.put(b'2', b'2')
+ db.put(b'3', b'3')
+ db.put(b'4', b'4')
+
+ # Out of range start key
+ assert_list_equal(
+ [b'2', b'3', b'4'],
+ list(db.iterator(start=b'1', include_value=False)))
+ assert_list_equal(
+ [b'2', b'3', b'4'],
+ list(db.iterator(start=b'1', include_start=False,
+ include_value=False)))
+
+ # Out of range stop key
+ assert_list_equal(
+ [b'4', b'3', b'2'],
+ list(db.iterator(stop=b'5', reverse=True, include_value=False)))
+ assert_list_equal(
+ [b'4', b'3', b'2'],
+ list(db.iterator(stop=b'5', include_stop=True, reverse=True,
+ include_value=False)))
+
+
def test_range_empty_database():
with tmp_db('range_empty_database') as db:
it = db.iterator()

0 comments on commit 1e13834

Please sign in to comment.