Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Tidy up test
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jan 17, 2017
1 parent d6c75cb commit 9e8e236
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/util/test_lrucache.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_set(self):
m = Mock()
cache = LruCache(1)

cache.set("key", "value", [m])
cache.set("key", "value", callbacks=[m])
self.assertFalse(m.called)

cache.set("key", "value")
Expand All @@ -144,7 +144,7 @@ def test_pop(self):
m = Mock()
cache = LruCache(1)

cache.set("key", "value", [m])
cache.set("key", "value", callbacks=[m])
self.assertFalse(m.called)

cache.pop("key")
Expand All @@ -163,10 +163,10 @@ def test_del_multi(self):
m4 = Mock()
cache = LruCache(4, 2, cache_type=TreeCache)

cache.set(("a", "1"), "value", [m1])
cache.set(("a", "2"), "value", [m2])
cache.set(("b", "1"), "value", [m3])
cache.set(("b", "2"), "value", [m4])
cache.set(("a", "1"), "value", callbacks=[m1])
cache.set(("a", "2"), "value", callbacks=[m2])
cache.set(("b", "1"), "value", callbacks=[m3])
cache.set(("b", "2"), "value", callbacks=[m4])

self.assertEquals(m1.call_count, 0)
self.assertEquals(m2.call_count, 0)
Expand All @@ -185,8 +185,8 @@ def test_clear(self):
m2 = Mock()
cache = LruCache(5)

cache.set("key1", "value", [m1])
cache.set("key2", "value", [m2])
cache.set("key1", "value", callbacks=[m1])
cache.set("key2", "value", callbacks=[m2])

self.assertEquals(m1.call_count, 0)
self.assertEquals(m2.call_count, 0)
Expand All @@ -202,14 +202,14 @@ def test_eviction(self):
m3 = Mock(name="m3")
cache = LruCache(2)

cache.set("key1", "value", [m1])
cache.set("key2", "value", [m2])
cache.set("key1", "value", callbacks=[m1])
cache.set("key2", "value", callbacks=[m2])

self.assertEquals(m1.call_count, 0)
self.assertEquals(m2.call_count, 0)
self.assertEquals(m3.call_count, 0)

cache.set("key3", "value", [m3])
cache.set("key3", "value", callbacks=[m3])

self.assertEquals(m1.call_count, 1)
self.assertEquals(m2.call_count, 0)
Expand All @@ -227,7 +227,7 @@ def test_eviction(self):
self.assertEquals(m2.call_count, 0)
self.assertEquals(m3.call_count, 0)

cache.set("key1", "value", [m1])
cache.set("key1", "value", callbacks=[m1])

self.assertEquals(m1.call_count, 1)
self.assertEquals(m2.call_count, 0)
Expand Down

0 comments on commit 9e8e236

Please sign in to comment.