summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Bolsterlee <uws@xs4all.nl>2012-09-12 00:22:46 +0200
committerWouter Bolsterlee <uws@xs4all.nl>2012-09-12 00:27:05 +0200
commitb0ce68120f9ce45fd298881ff24f0dc813f390a9 (patch)
tree6abbf811f9b362ca9cac10901ef6bd26ed5cbaa5
parentbafafd27760445f02daac10a030c2064767f8f95 (diff)
downloadhappybase-b0ce68120f9ce45fd298881ff24f0dc813f390a9.tar.gz
Add unit test for manually closed scanners
The unit tests for Table.scan() now test manually closing a scanner using the generator function's .close() method. See issue #8 for more information about this.
-rw-r--r--tests/test_api.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index e0c40aa..e322704 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -393,6 +393,13 @@ def test_scan():
scanner = table.scan(row_prefix='row', timestamp=123)
assert_equal(0, calc_len(scanner))
+ scanner = table.scan(batch_size=20)
+ next(scanner)
+ next(scanner)
+ scanner.close()
+ with assert_raises(StopIteration):
+ next(scanner)
+
def test_delete():
row_key = 'row-test-delete'