Show More
@@ -1332,7 +1332,7 b' class lrucachedict(object):' | |||
|
1332 | 1332 | |
|
1333 | 1333 | def get(self, k, default=None): |
|
1334 | 1334 | try: |
|
1335 |
return self._ |
|
|
1335 | return self.__getitem__(k) | |
|
1336 | 1336 | except KeyError: |
|
1337 | 1337 | return default |
|
1338 | 1338 |
@@ -67,6 +67,18 b' class testlrucachedict(unittest.TestCase' | |||
|
67 | 67 | for key in ('a', 'b'): |
|
68 | 68 | self.assertIn(key, d) |
|
69 | 69 | |
|
70 | def testget(self): | |
|
71 | d = util.lrucachedict(4) | |
|
72 | d['a'] = 'va' | |
|
73 | d['b'] = 'vb' | |
|
74 | d['c'] = 'vc' | |
|
75 | ||
|
76 | self.assertIsNone(d.get('missing')) | |
|
77 | self.assertEqual(list(d), ['c', 'b', 'a']) | |
|
78 | ||
|
79 | self.assertEqual(d.get('a'), 'va') | |
|
80 | self.assertEqual(list(d), ['a', 'c', 'b']) | |
|
81 | ||
|
70 | 82 | def testcopypartial(self): |
|
71 | 83 | d = util.lrucachedict(4) |
|
72 | 84 | d.insert('a', 'va', cost=4) |
General Comments 0
You need to be logged in to leave comments.
Login now