Exemplo n.º 1
0
 def test_sum_range_with_less_indexes(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23]), 35)
Exemplo n.º 2
0
 def test_regular_with_number_criteria(self):
     self.assertEqual(sumif([1, 1, 2, 2, 2], 2), 6)
Exemplo n.º 3
0
 def test_sum_range(self):
     self.assertEqual(
         sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633]), 668)
Exemplo n.º 4
0
 def test_sumif(result, criteria, values):
     assert sumif(values, criteria) == result
     assert sumif(values, criteria, values) == result
Exemplo n.º 5
0
 def test_sum_range_is_a_list(self):
     with self.assertRaises(TypeError):
         sumif(12, 12, 12)
Exemplo n.º 6
0
 def test_regular_with_string_criteria(self):
     assert 12 == sumif(((1, 2, 3, 4, 5), ), ">=3")
Exemplo n.º 7
0
 def test_sum_range_with_less_indexes(self):
     with pytest.raises(AssertionError):
         sumif(((1, 2, 3, 4, 5), ), ">=3", ((100, 123, 12, 23), ))
Exemplo n.º 8
0
 def test_sum_range(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633]), 668)
Exemplo n.º 9
0
 def test_sum_range_with_more_indexes(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633, 1]), 668)
Exemplo n.º 10
0
 def test_regular_with_number_criteria(self):
     self.assertEqual(sumif([1, 1, 2, 2, 2], 2), 6)
Exemplo n.º 11
0
 def test_regular_with_string_criteria(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3"), 12)
Exemplo n.º 12
0
 def test_criteria_is_number_string_boolean(self):
     self.assertEqual(sumif([1, 2, 3], [1, 2]), 0)
Exemplo n.º 13
0
 def test_sum_range_is_a_list(self):
     with self.assertRaises(TypeError):
         sumif(12, 12, 12)
Exemplo n.º 14
0
 def test_sum_range_with_less_indexes(self):
     with pytest.raises(AssertionError):
         sumif(((1, 2, 3, 4, 5), ), ">=3", ((100, 123, 12, 23), ))
Exemplo n.º 15
0
 def test_sum_range(self):
     assert 668 == sumif(((1, 2, 3, 4, 5), ), ">=3",
                         ((100, 123, 12, 23, 633), ))
Exemplo n.º 16
0
 def test_sum_range_with_less_indexes(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23]), 35)
Exemplo n.º 17
0
 def test_regular_with_number_criteria(self):
     assert 6 == sumif(((1, 1, 2, 2, 2), ), 2)
Exemplo n.º 18
0
 def test_regular_with_number_criteria(self):
     assert 6 == sumif([1, 1, 2, 2, 2], 2)
Exemplo n.º 19
0
 def test_sum_range(self):
     assert 668 == sumif(((1, 2, 3, 4, 5), ), ">=3",
                         ((100, 123, 12, 23, 633), ))
Exemplo n.º 20
0
 def test_regular_with_string_criteria(self):
     assert 12 == sumif([1, 2, 3, 4, 5], ">=3")
Exemplo n.º 21
0
 def test_sum_range_not_list(self):
     with pytest.raises(TypeError):
         sumif([], [], 'JUNK')
Exemplo n.º 22
0
 def test_sum_range(self):
     assert 668 == sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633])
Exemplo n.º 23
0
def test_sumif(data, result):
    if isinstance(result, type(Exception)):
        with pytest.raises(result):
            sumif(*data)
    else:
        assert sumif(*data) == result
Exemplo n.º 24
0
 def test_sum_range_with_more_indexes(self):
     assert 668 == sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633, 1])
Exemplo n.º 25
0
 def test_criteria_is_number_string_boolean(self):
     self.assertEqual(sumif([1, 2, 3], [1, 2]), 0)
Exemplo n.º 26
0
 def test_sum_range_with_less_indexes(self):
     assert 35 == sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23])
Exemplo n.º 27
0
 def test_regular_with_string_criteria(self):
     self.assertEqual(sumif([1, 2, 3, 4, 5], ">=3"), 12)
Exemplo n.º 28
0
 def test_sum_range_not_list(self):
     with pytest.raises(TypeError):
         sumif([], [], 'JUNK')
Exemplo n.º 29
0
 def test_sum_range_with_more_indexes(self):
     self.assertEqual(
         sumif([1, 2, 3, 4, 5], ">=3", [100, 123, 12, 23, 633, 1]), 668)
Exemplo n.º 30
0
 def test_sum_range_is_a_list(self):
     with pytest.raises(TypeError):
         sumif(12, 12, 12)
Exemplo n.º 31
0
 def test_sum_range_is_a_list(self):
     with pytest.raises(TypeError):
         sumif(12, 12, 12)
Exemplo n.º 32
0
 def test_sumif(expected, criteria, values):
     assert sumif(values, criteria) == expected
     assert sumif(values, criteria, values) == expected