def test_TrippleDigit(self): expected = [ [1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 1], [1, 2, 2], [1, 2, 3], [1, 3, 1], [1, 3, 2], [1, 3, 3], [2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 3, 1], [2, 3, 2], [2, 3, 3], [3, 1, 1], [3, 1, 2], [3, 1, 3], [3, 2, 1], [3, 2, 2], [3, 2, 3], [3, 3, 1], [3, 3, 2], [3, 3, 3], ] self.assertListEqual(generate(3, [1, 2, 3]), expected)
def test_TrippleDigit_DoubleRepeat(self): expected = [ [1, 1, 1], [2, 2, 2], [3, 3, 3], ] self.assertListEqual(generate(3, [1, 2, 3], consecutive_repeats=2), expected)
def test_SingleDigit(self): self.assertListEqual(generate(1, [1, 2, 3]), [[1], [2], [3]])
def test_ZeroLen(self): self.assertListEqual(generate(0, [1, 2, 3]), [])
def test_QuadrupleDigit_SingleRepeat(self): expected = [ [1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 1, 3], [1, 1, 2, 1], [1, 1, 2, 2], [1, 1, 2, 3], [1, 1, 3, 1], [1, 1, 3, 2], [1, 1, 3, 3], [1, 2, 1, 1], [1, 2, 2, 1], [1, 2, 2, 2], [1, 2, 2, 3], [1, 2, 3, 3], [1, 3, 1, 1], [1, 3, 2, 2], [1, 3, 3, 1], [1, 3, 3, 2], [1, 3, 3, 3], [2, 1, 1, 1], [2, 1, 1, 2], [2, 1, 1, 3], [2, 1, 2, 2], [2, 1, 3, 3], [2, 2, 1, 1], [2, 2, 1, 2], [2, 2, 1, 3], [2, 2, 2, 1], [2, 2, 2, 2], [2, 2, 2, 3], [2, 2, 3, 1], [2, 2, 3, 2], [2, 2, 3, 3], [2, 3, 1, 1], [2, 3, 2, 2], [2, 3, 3, 1], [2, 3, 3, 2], [2, 3, 3, 3], [3, 1, 1, 1], [3, 1, 1, 2], [3, 1, 1, 3], [3, 1, 2, 2], [3, 1, 3, 3], [3, 2, 1, 1], [3, 2, 2, 1], [3, 2, 2, 2], [3, 2, 2, 3], [3, 2, 3, 3], [3, 3, 1, 1], [3, 3, 1, 2], [3, 3, 1, 3], [3, 3, 2, 1], [3, 3, 2, 2], [3, 3, 2, 3], [3, 3, 3, 1], [3, 3, 3, 2], [3, 3, 3, 3], ] self.assertListEqual(generate(4, [1, 2, 3], consecutive_repeats=1), expected)
def test_QuadrupleDigit_CannotQuadrupleRepeat(self): self.assertListEqual(generate(4, [1, 2, 3], consecutive_repeats=4), [])
def test_TrippleDigit_CannotTrippleRepeat(self): self.assertListEqual(generate(3, [1, 2, 3], consecutive_repeats=3), [])
def test_DoubleDigit_SingleRepeat(self): expected = [[1, 1], [2, 2], [3, 3]] self.assertListEqual(generate(2, [1, 2, 3], consecutive_repeats=1), expected)
def test_DoubleDigit_CannotDoubleRepeat(self): self.assertListEqual(generate(2, [1, 2, 3], consecutive_repeats=2), [])
def test_SingleDigit_CannotRepeat(self): self.assertListEqual(generate(1, [1, 2, 3], consecutive_repeats=1), [])
def test_DoubleDigit(self): expected = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] self.assertListEqual(generate(2, [1, 2, 3]), expected)