Skip to content

Commit

Permalink
Update readme and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amitdev committed Oct 8, 2016
1 parent 523d3fd commit b276095
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ This can be used to build a LRU cache. Usage is almost like a dict.
# Would print [(3, '3'), (5, '5'), (2, '2'), (1, '1')]
print l.get_size()
#Would print 5
# Would print 5
l.set_size(3)
print l.items()
# Would print [(3, '3'), (5, '5'), (2, '2')]
Expand All @@ -59,9 +60,14 @@ This can be used to build a LRU cache. Usage is almost like a dict.
l.get_stats()
# Would print (1, 0)
l.update(5='0') # Update an item
print l.items()
# Would print [(5, '0'), (3, '3'), (2, '2')]
l.clear()
print l.items()
#Would print []
# Would print []
Install
=======
Expand Down
5 changes: 5 additions & 0 deletions test/test_lru.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,17 @@ def test_update(self):
l['b'] = 2
self.assertEqual(l['b'], 2)
l.update(b=3)
self.assertEqual(('b', 3), l.peek_first_item())
self.assertEqual(l['a'], 2)
self.assertEqual(l['b'], 3)
l.update({'a':1, 'b':2})
self.assertEqual(('b', 2), l.peek_first_item())
self.assertEqual(l['a'], 1)
self.assertEqual(l['b'], 2)
l.update()
self.assertEqual(('b', 2), l.peek_first_item())
l.update(a=2)
self.assertEqual(('a', 2), l.peek_first_item())


def test_peek_first_item(self):
Expand Down

0 comments on commit b276095

Please sign in to comment.