def test_duplicates(self): l2r = Log2Rotate() state = [1, 1, 2, 2, 3, 3, 4, 4] self.assertRaises(Log2RotatePeriodError, l2r.backups_to_keep, state)
def test_two(self): self.assertEqual([0, 1, -1, 2, -2], Log2Rotate.fuzzy_range(2))
def test_simple(self): l2r = Log2Rotate() state = [1, 2, 3, 4] self.assertEqual([1, 3, 4], l2r.backups_to_keep(state))
def test_one(self): self.assertEqual([0, 1, -1], Log2Rotate.fuzzy_range(1))
def test_zero(self): self.assertEqual([0], Log2Rotate.fuzzy_range(0))