예제 #1
0
 def test_3(self):
     l1 = [1, 2, 3, -4, 5, 6]
     l2 = filter.are_divisible_by_n(2, l1)
     self.assertListAlmostEqual(l2, [2, -4, 6])
     l1 = [1, 2, 3, 4, 5, 6]
     l2 = filter.are_divisible_by_n(3, l1)
     self.assertListAlmostEqual(l2, [3, 6])
예제 #2
0
 def test_10(self):
     poly1 = [10, 6, 20, 23, 2, 25]
     number = 5
     poly2 = filter.are_divisible_by_n(poly1, number)
     self.assertEqual(poly2, [10, 20, 25])
예제 #3
0
 def test_9(self):
     poly1 = [2, 3, 4]
     number = 1
     poly2 = filter.are_divisible_by_n(poly1, number)
     self.assertEqual(poly2, [2, 3, 4])
예제 #4
0
 def test_8(self):
     poly1 = [2, 4, 6, 7, 9, 1]
     number = 3
     poly2 = filter.are_divisible_by_n(poly1, number)
     self.assertEqual(poly2, [6, 9])
예제 #5
0
 def test_are_divisible_by_n_2(self):
     iList = [0, -1, 8, 12, -16]
     n = 4
     oList = [0, 8, 12, -16]
     self.assertListEqual(filter.are_divisible_by_n(iList, n), oList)
예제 #6
0
 def test_are_divisible_by_n_1(self):
     iList = [10, 9, 6]
     n = 3
     oList = [9, 6]
     self.assertListEqual(filter.are_divisible_by_n(iList, n), oList)
예제 #7
0
 def test_divisible(self):
     list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
     n = 2
     list2 = filter.are_divisible_by_n(list1, n)
     self.assertListAlmostEqual(list2, [2, 4, 6, 8, 10])
예제 #8
0
 def test_divisible_2(self):
     list1 = [20, 55, 32, 43, 67, 55, 100, 74]
     n = 5
     list2 = filter.are_divisible_by_n(list1, n)
     self.assertListAlmostEqual(list2, [20, 55, 55, 100])
예제 #9
0
 def test_are_divisible_by_n_2(self):
     nums = [9, -3, 300, 2]
     value = 3
     divisible = filter.are_divisible_by_n(nums, value)
     self.assertListAlmostEqual(divisible, [9, -3, 300])
예제 #10
0
 def test_are_divisible_by_n_1(self):
     nums = [10, -1, 0, -100]
     value = 5
     divisible = filter.are_divisible_by_n(nums, value)
     self.assertListAlmostEqual(divisible, [10, 0, -100])
예제 #11
0
 def test_are_divisible_by_n_2(self):
     input_list = [3, 6, 9, 10, 15, 20]
     n = 2
     self.assertListEqual(filter.are_divisible_by_n(input_list, n),
                          [6, 10, 20])
예제 #12
0
 def test_are_divisible_by_n_1(self):
     input_list = [2, 3, 4, 20]
     n = 2
     self.assertListEqual(filter.are_divisible_by_n(input_list, n),
                          [2, 4, 20])
예제 #13
0
 def test_divisible2(self):
     self.assertEqual(filter.are_divisible_by_n([1, 3, -4, -5, 6], 1),
                      [1, 3, -4, -5, 6])