class TestVisitorCounterByQueue(unittest.TestCase): def setUp(self): self.counter = VisitorCounterByQueue() def test_of_same_hour_get(self): self.counter.log_hit(1) self.counter.log_hit(1) self.counter.log_hit(2) ans = self.counter.get_hit(4) self.assertEqual(ans, 3) def test_of_another_hour_get(self): self.counter.log_hit(1) self.counter.log_hit(1) self.counter.log_hit(2) ans = self.counter.get_hit(61) self.assertEqual(ans, 1)
def setUp(self): self.counter = VisitorCounterByQueue()