예제 #1
0
def test_relative_by_negative_two_with_default():
    assert relative_to([2, 4, 6, 9, 7], 9, offset=-2, default=16) == 4
예제 #2
0
def test_relative_by_positive_two_with_default():
    assert relative_to([2, 4, 6, 9, 7], 4, offset=+2, default=12) == 9
예제 #3
0
def test_relative_by_negative_one_with_default():
    assert relative_to([4, 6, 9], 6, offset=-1, default=14) == 4
예제 #4
0
def test_relative_by_positive_one_with_default():
    assert relative_to([4, 6, 9], 6, offset=+1, default=5) == 9
예제 #5
0
def test_relative_by_negative_one():
    assert relative_to([4, 6, 9], 6, offset=-1) == 4
예제 #6
0
def test_relative_by_negative_zero_with_default():
    assert relative_to([4, 6, 9], 6, offset=0, default=9) == 6
예제 #7
0
def test_relative_by_negative_three_to_oneth_occurrence():
    assert relative_to([2, 4, 5, 4, 6, 8, 10], 4, offset=-3, n=1) == 2
예제 #8
0
def test_relative_by_positive_two_to_oneth_occurrence_with_default():
    assert relative_to([2, 4, 5, 4, 6, 8, 10], 4, offset=2, n=1,
                       default=12) == 8
예제 #9
0
def test_relative_by_positive_two_out_of_range_raises_value_error():
    with raises(ValueError):
        relative_to([2, 4, 6, 9, 7], 9, offset=+2)
예제 #10
0
def test_relative_by_positive_two_to_oneth_occurrence():
    assert relative_to([2, 4, 5, 4, 6, 8, 10], 4, offset=2, n=1) == 8
예제 #11
0
def test_relative_by_positive_two():
    assert relative_to([2, 4, 6, 9, 7], 4, offset=+2) == 9
예제 #12
0
def test_relative_by_negative_two():
    assert relative_to([2, 4, 6, 9, 7], 9, offset=-2) == 4
예제 #13
0
def test_relative_by_positive_one():
    assert relative_to([4, 6, 9], 6, offset=+1) == 9
예제 #14
0
def test_relative_by_negative_two_out_of_range_raises_value_error_with_default(
):
    assert relative_to([2, 4, 6, 9, 7], 4, offset=-2, default=97) == 97
예제 #15
0
def test_relative_to_missing_item_return_default():
    assert relative_to([4, 6, 9], 12, offset=1, default=38) == 38
예제 #16
0
def test_relative_by_positive_two_out_of_range_raises_value_error_with_default(
):
    assert relative_to([2, 4, 6, 9, 7], 9, offset=+2, default=67) == 67
예제 #17
0
def test_relative_to_missing_item_raises_value_error():
    with raises(ValueError):
        relative_to([4, 6, 9], 12, offset=1)
예제 #18
0
def test_relative_by_negative_three_to_oneth_occurrence_with_default():
    assert relative_to([2, 4, 5, 4, 6, 8, 10], 4, offset=-3, n=1,
                       default=37) == 2
예제 #19
0
def test_relative_by_negative_zero():
    assert relative_to([4, 6, 9], 6, offset=0) == 6