Permalink
Browse files

Correctly pack slice ends for xget()

Fixes #167
  • Loading branch information...
1 parent 2dd02da commit 65af17241c109518409a0456061eb62462a161df @thobbs thobbs committed Aug 19, 2012
Showing with 18 additions and 2 deletions.
  1. +6 −2 pycassa/columnfamily.py
  2. +12 −0 tests/test_autopacking.py
View
@@ -533,9 +533,13 @@ def xget(self, key, column_start="", column_finish="", column_reversed=False,
count = i = 0
last_name = finish = ""
if column_start != "":
- last_name = self._pack_name(column_start)
+ last_name = self._pack_name(column_start,
+ is_supercol_name=self.super,
+ slice_start=(not column_reversed))
if column_finish != "":
- finish = self._pack_name(column_finish)
+ finish = self._pack_name(column_finish,
+ is_supercol_name=self.super,
+ slice_start=column_reversed)
while True:
if column_count is not None:
View
@@ -147,6 +147,18 @@ def test_standard_column_family(self):
# Test xget paging
assert_equal(list(cf.xget(KEYS[0], buffer_size=2)), gdict.items())
+ assert_equal(list(cf.xget(KEYS[0], column_reversed=True, buffer_size=2)),
+ list(reversed(gdict.items())))
+ assert_equal(list(cf.xget(KEYS[0], column_start=gcols[0], buffer_size=2)),
+ gdict.items())
+ assert_equal(list(cf.xget(KEYS[0], column_finish=gcols[2], buffer_size=2)),
+ gdict.items())
+ assert_equal(list(cf.xget(KEYS[0], column_start=gcols[2], column_finish=gcols[0],
+ column_reversed=True, buffer_size=2)),
+ list(reversed(gdict.items())))
+ assert_equal(list(cf.xget(KEYS[0], column_start=gcols[1], column_finish=gcols[1],
+ column_reversed=True, buffer_size=2)),
+ [(gcols[1], VALS[1])])
# Test removing rows
cf.remove(KEYS[0], columns=gcols[:1])

0 comments on commit 65af172

Please sign in to comment.