tests inventory and reordering + PEP8 enhancement

This commit is contained in:
Hardirc committed 2016-03-26 13:19:29 -04:00
1 parent 58a8ba067c
commit 9ac1e7188f
1 file changed
+13 -7
+13 -7
View File
@@ -37,10 +37,11 @@ def tearDownModule():
pass pass
class TestCache(unittest.TestCase): class TestCache(unittest.TestCase):
def testCacheInRam(self): # TODO: test_CacheAbstract(self):
def test_CacheInRam(self):
# defaults to mode='http' # defaults to mode='http'
cache = CacheInRam() cache = CacheInRam()
@@ -67,8 +68,7 @@ class TestCache(unittest.TestCase):
cache.increment('b') cache.increment('b')
self.assertEqual(cache('b', lambda: 'x', 100), 1) self.assertEqual(cache('b', lambda: 'x', 100), 1)
def test_CacheOnDisk(self):
def testCacheOnDisk(self):
# defaults to mode='http' # defaults to mode='http'
s = Storage({'application': 'admin', s = Storage({'application': 'admin',
@@ -97,7 +97,13 @@ class TestCache(unittest.TestCase):
cache.increment('b') cache.increment('b')
self.assertEqual(cache('b', lambda: 'x', 100), 1) self.assertEqual(cache('b', lambda: 'x', 100), 1)
def testCacheWithPrefix(self): # TODO: def test_CacheAction(self):
# TODO: def test_Cache(self):
# TODO: def test_lazy_cache(self):
def test_CacheWithPrefix(self):
s = Storage({'application': 'admin', s = Storage({'application': 'admin',
'folder': 'applications/admin'}) 'folder': 'applications/admin'})
cache = Cache(s) cache = Cache(s)
@@ -106,7 +112,7 @@ class TestCache(unittest.TestCase):
self.assertEqual(prefix('a', lambda: 2, 100), 1) self.assertEqual(prefix('a', lambda: 2, 100), 1)
self.assertEqual(cache.ram('prefixa', lambda: 2, 100), 1) self.assertEqual(cache.ram('prefixa', lambda: 2, 100), 1)
def testRegex(self): def test_Regex(self):
cache = CacheInRam() cache = CacheInRam()
self.assertEqual(cache('a1', lambda: 1, 0), 1) self.assertEqual(cache('a1', lambda: 1, 0), 1)
self.assertEqual(cache('a2', lambda: 2, 100), 2) self.assertEqual(cache('a2', lambda: 2, 100), 2)
@@ -114,7 +120,7 @@ class TestCache(unittest.TestCase):
self.assertEqual(cache('a1', lambda: 2, 0), 2) self.assertEqual(cache('a1', lambda: 2, 0), 2)
self.assertEqual(cache('a2', lambda: 3, 100), 3) self.assertEqual(cache('a2', lambda: 3, 100), 3)
def testDALcache(self): def test_DALcache(self):
s = Storage({'application': 'admin', s = Storage({'application': 'admin',
'folder': 'applications/admin'}) 'folder': 'applications/admin'})
cache = Cache(s) cache = Cache(s)