コード例 #1
0
def test_keep_function_with_no_iterable():
    operator = Keep()
    with pytest.raises(TypeError):
        operator.function(None, 1)
コード例 #2
0
def test_keep_function_when_keeping_zero_values():
    operator = Keep()
    actual = operator.function([1, 2, 3], 0)
    assert actual == []
コード例 #3
0
def test_keep_function_with_invalid_iterable():
    operator = Keep()
    with pytest.raises(TypeError):
        operator.function(1, 1)
コード例 #4
0
def test_keep_function_when_keeping_more_values_than_exist():
    operator = Keep()
    actual = operator.function([1, 2, 3], 5)
    assert actual == [1, 2, 3]