Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def test_SingleDigit(self):
     self.assertListEqual(generate(1, [1, 2, 3]), [[1], [2], [3]])
Example #4
0
 def test_ZeroLen(self):
     self.assertListEqual(generate(0, [1, 2, 3]), [])
Example #5
0
 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)
Example #6
0
 def test_QuadrupleDigit_CannotQuadrupleRepeat(self):
     self.assertListEqual(generate(4, [1, 2, 3], consecutive_repeats=4), [])
Example #7
0
 def test_TrippleDigit_CannotTrippleRepeat(self):
     self.assertListEqual(generate(3, [1, 2, 3], consecutive_repeats=3), [])
Example #8
0
 def test_DoubleDigit_SingleRepeat(self):
     expected = [[1, 1], [2, 2], [3, 3]]
     self.assertListEqual(generate(2, [1, 2, 3], consecutive_repeats=1),
                          expected)
Example #9
0
 def test_DoubleDigit_CannotDoubleRepeat(self):
     self.assertListEqual(generate(2, [1, 2, 3], consecutive_repeats=2), [])
Example #10
0
 def test_SingleDigit_CannotRepeat(self):
     self.assertListEqual(generate(1, [1, 2, 3], consecutive_repeats=1), [])
Example #11
0
 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)