Exemple #1
0
 def test_lru_contains(self):
     bset = BoundedSet(max_items=10)
     [bset.add(i) for i in range(10)]
     assert 0 in bset
     bset.add(10)
     assert 0 in bset
     assert 1 not in bset
Exemple #2
0
 def test_lru_add(self):
     bset = BoundedSet(max_items=10)
     [bset.add(i) for i in range(10)]
     bset.add(0)
     bset.add(10)
     assert 0 in bset
     assert 1 not in bset
Exemple #3
0
 def test_bound(self):
     bset = BoundedSet(max_items=10)
     [bset.add(i) for i in range(11)]
     assert len(bset._set) == 10
     assert 0 not in bset
Exemple #4
0
 def test_contains(self):
     bset = BoundedSet(max_items=10)
     bset.add(1)
     assert 1 in bset