Beispiel #1
0
 def test_combinations(self):
     c = [comb for comb in combinations.generate_combinations("WXYZ", 2)]
     res = [
         ['W', 'X'], ['W', 'Y'], ['W', 'Z'],
         ['X', 'Y'], ['X', 'Z'],
         ['Y', 'Z']
     ]
     self.assertEqual(c, res)
     
     c = [comb for comb in combinations.generate_combinations("WWYZ", 3)]
     res = [
         ['W', 'W', 'Y'], ['W', 'W', 'Z'],
         ['W', 'Y', 'Z'], ['W', 'Y', 'Z'],
     ]
     self.assertEqual(c, res)
Beispiel #2
0
 def test_invalid_n(self):
     c = [comb for comb in combinations.generate_combinations("WWYZ", 5)]
     self.assertEqual(len(c), 0)