Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename "reversed" range view to "descending"

  • Loading branch information...
commit 1578838f508927960523cfdb861e28ccd176ea45 1 parent ee74ee0
@j4mie authored
Showing with 18 additions and 14 deletions.
  1. +4 −0 README.md
  2. +3 −3 docs/04-sorted-sets.md
  3. +3 −3 rediset.py
  4. +8 −8 tests.py
View
4 README.md
@@ -10,6 +10,10 @@ Full documentation is available at [http://j4mie.github.com/rediset](http://j4mi
## Changelog
+#### 0.9.0
+
+* Rename "reversed" range view to "descending"
+
#### 0.8.0
* Add support for range views on sorted sets; ss.reversed and ss.withscores
View
6 docs/04-sorted-sets.md
@@ -58,15 +58,15 @@ functions in redis-py, so please look at its documentation for more information.
Sorted sets also support *range views*, which are used to pass arguments to the
underlying zrange calls while still allowing Pythonic slicing syntax. The two
-provided range views are `withscores` and `reversed`:
+provided range views are `withscores` and `descending`:
>>> s[0]
'a'
- >>> s.reversed[0]
+ >>> s.descending[0]
'c'
>>> s.withscores[0]
('a', 1.0)
- >>> s.reversed.withscores[0]
+ >>> s.descending.withscores[0]
('c', 3.0)
## Sorted set operations
View
6 rediset.py
@@ -228,7 +228,7 @@ def withscores(self):
return self
@property
- def reversed(self):
+ def descending(self):
self.overrides['desc'] = True
return self
@@ -269,8 +269,8 @@ def withscores(self):
return self.range_view().withscores
@property
- def reversed(self):
- return self.range_view().reversed
+ def descending(self):
+ return self.range_view().descending
class SortedSetNode(SortedNode):
View
16 tests.py
@@ -164,26 +164,26 @@ def test_withscores_property(self):
self.assertEqual(s.withscores[0:-1], [('a', 1), ('b', 2), ('c', 3)])
self.assertEqual(s.withscores[0], ('a', 1))
- def test_reversed_property(self):
+ def test_descending_property(self):
s = self.rediset.SortedSet('key')
s.add(('a', 1), ('b', 2), ('c', 3))
self.assertEqual(s[0:-1], ['a', 'b', 'c'])
- self.assertEqual(s.reversed[0:-1], ['c', 'b', 'a'])
- self.assertEqual(s.reversed[0], 'c')
+ self.assertEqual(s.descending[0:-1], ['c', 'b', 'a'])
+ self.assertEqual(s.descending[0], 'c')
- def test_reversed_withscores(self):
+ def test_descending_withscores(self):
s = self.rediset.SortedSet('key')
s.add(('a', 1), ('b', 2), ('c', 3))
self.assertEqual(s[0:-1], ['a', 'b', 'c'])
- self.assertEqual(s.reversed.withscores[0:-1], [('c', 3), ('b', 2), ('a', 1)])
- self.assertEqual(s.reversed.withscores[0], ('c', 3))
+ self.assertEqual(s.descending.withscores[0:-1], [('c', 3), ('b', 2), ('a', 1)])
+ self.assertEqual(s.descending.withscores[0], ('c', 3))
- self.assertEqual(s.withscores.reversed[0:-1], [('c', 3), ('b', 2), ('a', 1)])
- self.assertEqual(s.withscores.reversed[0], ('c', 3))
+ self.assertEqual(s.withscores.descending[0:-1], [('c', 3), ('b', 2), ('a', 1)])
+ self.assertEqual(s.withscores.descending[0], ('c', 3))
def test_iteration(self):
s = self.rediset.SortedSet('key')
Please sign in to comment.
Something went wrong with that request. Please try again.