예제 #1
0
 def test_include_most(self):
     self.assertIn(subsample_list([1, 2, 3, 4, 5, 6], 5), [
         [1, 3, 4, 5, 6],
         [1, 2, 4, 5, 6],
         [1, 2, 3, 5, 6],
         [1, 2, 3, 4, 6],
     ])
예제 #2
0
 def test_include_4_of_6(self):
     self.assertIn(subsample_list([1, 2, 3, 4, 5, 6], 4),
                   [[1] + middle + [6] for middle in [
                       [2, 3],
                       [2, 4],
                       [2, 5],
                       [3, 4],
                       [3, 5],
                       [4, 5],
                   ]])
예제 #3
0
 def test_every_third(self):
     self.assertEqual(subsample_list([1, 2, 3, 4, 5, 6], 2), [1, 6])
예제 #4
0
 def test_halving_uneven_2(self):
     self.assertEqual(subsample_list([1, 2, 3, 4, 5], 3), [1, 3, 5])
예제 #5
0
 def test_halving_longer(self):
     self.assertEqual(subsample_list([1, 2, 3, 4], 2), [1, 4])
예제 #6
0
 def test_trivial(self):
     self.assertEqual(subsample_list([1, 2], 2), [1, 2])