Permalink
Browse files

More coverage for inserting items in arbitrary order

  • Loading branch information...
1 parent 6455ef8 commit 97b978c75fd8427fe5ef7c04d851749e5f1223db @dcramer dcramer committed Sep 7, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 tests/tests.py
View
@@ -96,3 +96,29 @@ def test_non_timestamp_scores(self):
self.assertEquals(results[0], 1)
self.assertEquals(results[1], 2)
self.assertEquals(results[2], 3)
+
+ def test_score_scoping(self):
+ timeline = Timeline(connection=self.c1, bucket=self.bucket, max_items=3)
+
+ timeline.add(self.key, 1, 3)
+ timeline.add(self.key, 2, 2)
+ timeline.add(self.key, 3, 1)
+ results = timeline.get(self.key)
+ self.assertEqual(len(results), 3)
+ self.assertEquals(results[0], 1)
+ self.assertEquals(results[1], 2)
+ self.assertEquals(results[2], 3)
+
+ timeline.add(self.key, 4, 0)
+ results = timeline.get(self.key)
+ self.assertEqual(len(results), 3)
+ self.assertEquals(results[0], 1)
+ self.assertEquals(results[1], 2)
+ self.assertEquals(results[2], 3)
+
+ timeline.add(self.key, 5, 5)
+ results = timeline.get(self.key)
+ self.assertEqual(len(results), 3)
+ self.assertEquals(results[0], 5)
+ self.assertEquals(results[1], 1)
+ self.assertEquals(results[2], 2)

0 comments on commit 97b978c

Please sign in to comment.