Coding style.

Moved the Result class into tools, which simplifies worker.py and makes the
circular import problem go away.
This commit is contained in:
Andrew Hamilton 2016-02-13 18:48:53 +00:00
parent cc95534bd7
commit 2373e78cbd
5 changed files with 151 additions and 149 deletions

View file

@ -18,29 +18,6 @@ import golden
import vigil
class LruCacheWithEvictionTestCase(unittest.TestCase):
def _assert_cache(self, func, hits, misses, current_size):
cache_info = func.cache_info()
self.assertEqual(cache_info.hits, hits)
self.assertEqual(cache_info.misses, misses)
self.assertEqual(cache_info.currsize, current_size)
def test_lru_cache_with_eviction(self):
@vigil.lru_cache_with_eviction()
def a(foo):
return foo
self._assert_cache(a, 0, 0, 0)
self.assertEqual(a(1), 1)
self._assert_cache(a, 0, 1, 1)
a(1)
self._assert_cache(a, 1, 1, 1)
a.evict(1)
self._assert_cache(a, 1, 1, 1)
a(1)
self._assert_cache(a, 1, 2, 2)
_DIMENSIONS = (100, 60)