예제 #1
0
def test_positive_case3():
    """Testing example 3 from the task"""
    assert custom_range(string.ascii_lowercase, "p", "g", -2) == [
        "p",
        "n",
        "l",
        "j",
        "h",
    ]
예제 #2
0
def test_positive_case2():
    """Testing example 2 from the task"""
    assert custom_range(string.ascii_lowercase, "g", "p") == [
        "g",
        "h",
        "i",
        "j",
        "k",
        "l",
        "m",
        "n",
        "o",
    ]
예제 #3
0
def test_custom_range():

    assert hw5.custom_range(string.ascii_lowercase, "g") == [
        "a",
        "b",
        "c",
        "d",
        "e",
        "f",
    ]
    assert hw5.custom_range(string.ascii_lowercase, "g", "p") == [
        "g",
        "h",
        "i",
        "j",
        "k",
        "l",
        "m",
        "n",
        "o",
    ]
    assert hw5.custom_range(string.ascii_lowercase, "p", "g", -2) == [
        "p",
        "n",
        "l",
        "j",
        "h",
    ]
    arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
    assert hw5.custom_range(string.ascii_lowercase, "p", "g", -2) == [
        "p",
        "n",
        "l",
        "j",
        "h",
    ]
    assert hw5.custom_range(arr, 2, 9, 3) == [2, 5, 8]
예제 #4
0
def test_positive_case1():
    """Testing example 1 from the task"""
    assert custom_range(string.ascii_lowercase,
                        "g") == ["a", "b", "c", "d", "e", "f"]
예제 #5
0
def test_negative_case3():
    """Testing with tuples"""
    assert not custom_range((1, 2, 3, 4, 5, 6), 2, 5) != [2, 3, 4]
예제 #6
0
def test_negative_case2():
    """Testing with lists"""
    assert not custom_range([1, 2, 3, 4, 5, 6], 2, 5) != [2, 3, 4]
예제 #7
0
def test_negative_case1():
    """Testing with string of non-ascii symbols"""
    assert not custom_range("äüöß", "ö") != ["ä", "ü"]
예제 #8
0
def test_custom_range_test_3_pos_args():
    range_output = ["p", "n", "l", "j", "h"]
    test_range = list(hw5.custom_range(string.ascii_lowercase, "p", "g", -2))
    assert test_range == range_output
예제 #9
0
def test_custom_range_test_2_pos_args():
    range_output = ["g", "h", "i", "j", "k", "l", "m", "n", "o"]
    test_range = list(hw5.custom_range(string.ascii_lowercase, "g", "p"))
    assert test_range == range_output
예제 #10
0
def test_custom_range_test_one_pos_arg():
    range_output = ["a", "b", "c", "d", "e", "f"]
    test_range = list(hw5.custom_range(string.ascii_lowercase, "g"))
    assert test_range == range_output