def test_get(self): image_counter = ImageCounter() image_counter.add(1) assert image_counter.get(1) == 0 image_counter.next(1) assert image_counter.get(1) == 1
def test_add(self): image_counter = ImageCounter() image_counter.add(1) assert image_counter.get(1) == 0 image_counter.add(1, 5) assert image_counter.get(1) == 5
def test_add_negative(self): with pytest.raises(ValueError): image_counter = ImageCounter() image_counter.add(1, -1)
def test_exists(self): image_counter = ImageCounter() image_counter.add(1) assert image_counter.exists(1)