def test_sum_range_not_list(self): with pytest.raises(TypeError): sumifs( 'JUNK', [], [], )
def test_ifs_size_errors(self): criteria, v1 = self.responses['sumifs'][0][1:] v2 = (v1[0][:-1], ) assert countifs(v1, criteria, v2, criteria) == VALUE_ERROR assert sumifs(v1, v1, criteria, v2, criteria) == VALUE_ERROR assert maxifs(v1, v1, criteria, v2, criteria) == VALUE_ERROR assert minifs(v1, v1, criteria, v2, criteria) == VALUE_ERROR assert averageifs(v1, v1, criteria, v2, criteria) == VALUE_ERROR
def test_multiple_criteria(self): assert 7 == sumifs(((1, 2, 3, 4, 5), ), ((1, 2, 3, 4, 5), ), ">=3", ((1, 2, 3, 4, 5), ), "<=4")
def test_regular_with_number_criteria(self): assert 6 == sumifs(((1, 1, 2, 2, 2), ), ((1, 1, 2, 2, 2), ), 2)
def test_sum_range_with_less_indexes(self): assert 35 == sumifs([100, 123, 12, 23], [1, 2, 3, 4, 5], ">=3")
def test_sum_range(self): assert 668 == sumifs([100, 123, 12, 23, 633], [1, 2, 3, 4, 5], ">=3")
def test_regular_with_number_criteria(self): assert 6 == sumifs([1, 1, 2, 2, 2], [1, 1, 2, 2, 2], 2)
def test_sumifs(data, result): if isinstance(result, type(Exception)): with pytest.raises(result): sumifs(*data) else: assert sumifs(*data) == result
def test_sum_range_is_a_list(self): with pytest.raises(TypeError): sumifs(12, 12, 12)
def test_multiple_criteria(self): assert 7 == sumifs(((1, 2, 3, 4, 5), ), ((1, 2, 3, 4, 5), ), ">=3", ((1, 2, 3, 4, 5), ), "<=4")
def test_sum_range_with_empty(self): assert 35 == sumifs(((100, 123, 12, 23, None), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_sum_range_rect(self): assert 35 == sumifs(((100, 123), (12, 23)), ((1, 2), (3, 4)), ">=3")
def test_sum_range(self): assert 668 == sumifs(((100, 123, 12, 23, 633), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_regular_with_string_criteria(self): assert 12 == sumifs(((1, 2, 3, 4, 5), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_sumifs(result, criteria, values): assert sumifs(values, values, criteria) == result
def test_regular_with_number_criteria(self): assert 6 == sumifs(((1, 1, 2, 2, 2), ), ((1, 1, 2, 2, 2), ), 2)
def test_regular_with_string_criteria(self): assert 12 == sumifs(((1, 2, 3, 4, 5), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_sum_range_is_a_list(self): with pytest.raises(TypeError): sumifs(12, 12, 12)
def test_sum_range(self): assert 668 == sumifs(((100, 123, 12, 23, 633), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_regular_with_string_criteria(self): assert 12 == sumifs([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], ">=3")
def test_sum_range_rect(self): assert 35 == sumifs(((100, 123), (12, 23)), ((1, 2), (3, 4)), ">=3")
def test_sum_range_with_more_indexes(self): assert 668 == sumifs([100, 123, 12, 23, 633, 1], [1, 2, 3, 4, 5], ">=3")
def test_sum_range_with_empty(self): assert 35 == sumifs(((100, 123, 12, 23, None), ), ((1, 2, 3, 4, 5), ), ">=3")
def test_sum_range_with_empty(self): assert 35 == sumifs([100, 123, 12, 23, None], [1, 2, 3, 4, 5], ">=3")
def test_sum_range_not_list(self): with pytest.raises(TypeError): sumifs('JUNK', ((), ), ((), ), )
def test_multiple_criteria(self): assert 7 == sumifs([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], ">=3", [1, 2, 3, 4, 5], "<=4")
def test_sumifs(expected, criteria, values): assert sumifs(values, values, criteria) == expected