Exemple #1
0
def test_list_swp():
    str1 = DIN5007_1("Jäger")
    str2 = DIN5007_1("jagen")
    L = Liste([str1, str2])
    L.swp(1, 2)
    result = str(L)
    expected_result = "['jagen', 'Jäger']"
    assert result == expected_result
Exemple #2
0
def test_list_gets_second_object():
    str1 = DIN5007_1("Jäger")
    str2 = DIN5007_1("jagen")
    L = Liste([str1, str2])
    result = str(L[2])
    expected_result = "jagen"
    assert result == expected_result
Exemple #3
0
def test_list_returns_error_trying_to_get_zeroth_object():
    with pytest.raises(IndexError):
        str1 = DIN5007_1("Jäger")
        str2 = DIN5007_1("jagen")
        L = Liste([str1, str2])
        result = str(L[0])
        expected_result = IndexError
        assert result == expected_result
Exemple #4
0
def test_Liste_index_returns_storage_location():
    str1 = DIN5007_1("one")
    str2 = DIN5007_1("two")
    str3 = DIN5007_1("three")
    L = Liste([str1, str2, str3])
    result = L[1]
    expected_result = L[1]
    assert result == expected_result
Exemple #5
0
def test_length_of_list():
    str1 = DIN5007_1("one")
    str2 = DIN5007_1("two")
    str3 = DIN5007_1("three")
    L = Liste([str1, str2, str3])
    result = len(L)
    expected_result = 3
    assert result == expected_result
Exemple #6
0
def test_heapify():
    str1 = DIN5007_1("Jäger")
    str2 = DIN5007_1("jagen")
    L = Liste([str1, str2])
    heapsort(L)
    result = str(L)
    expected_result = "['jagen', 'Jäger']"
    assert result == expected_result
Exemple #7
0
def test_max_heapify():
    str1 = DIN5007_1("Jäger")
    str2 = DIN5007_1("jagen")
    L = Liste([str1, str2])
    max_heapify(L, 2, count=1)
    result = L.l
    expected_result = [str1, str2]
    assert result == expected_result