def test_progression_range_step(self): s = Progression(1, 9, 2) self.assertEqual(str(s), "1-9x2")
def test_empty(self): result = Progression.factory([]) self.assertEqual(result, [])
def test_seq_to_longest_progressions(self): s = Sequence.create("1-10, 14, 20-48x4") progs = Progression.factory(s) self.assertEqual(len(progs), 3)
def test_single(self): result = Progression.factory([3]) self.assertEqual(len(result), 1) self.assertEqual(str(result[0]), "3")
def test_order(self): numbers = [3, 5, 8, 10, 12] numbers.reverse() result = Progression.factory(numbers) self.assertEqual(str(result[0]), "3-5x2") self.assertEqual(str(result[1]), "8-12x2")
def test_range_max_2(self): result = Progression.factory([2, 4, 6, 8, 10], max_size=2) self.assertEqual(len(result), 3)
def test_progression_at_start(self): result = Progression.factory([3, 5, 7, 10, 15]) self.assertEqual(len(result), 2) self.assertEqual(str(result[0]), "3-7x2")
def test_from_range(self): result = Progression.factory(xrange(2, 97, 3)) self.assertEqual(len(result), 1) self.assertEqual(len(result[0]), 32)
def test_progression_at_end(self): result = Progression.factory([3, 5, 8, 10, 12]) self.assertEqual(str(result[1]), "8-12x2")
def test_two(self): result = Progression.factory([3, 7]) self.assertEqual(len(result), 1) self.assertEqual(str(result[0]), "3-7x4")
def test_range_max_16(self): result = Progression.factory(xrange(2, 197, 3), max_size=16) self.assertEqual(len(result[0]), 16) self.assertEqual(len(result), 5)
def test_seq_to_limited_length_progressions(self): s = Sequence.create("1-10, 14, 20-48x4") progs = Progression.factory(s, max_size=4) self.assertEqual(len(progs), 6)
def test_progression_single(self): s = Progression(1, 1, 1) self.assertEqual(str(s), "1")
def test_progression_range(self): s = Progression(1, 10, 1) self.assertEqual(str(s), "1-10")