コード例 #1
0
def test_sort_encyclopaeda():
    """Test Actions through their implementation in Encyclopaedia."""

    enc = Encyclopaedia()

    for x in range(5):
        EncEntry(parent=enc,
                 name="Test Name",
                 text=["Test Text"],
                 locked=False)

    enc.Sort(sorting_mode=Encyclopaedia.SORT_SUBJECT)()

    assert Encyclopaedia.SORT_SUBJECT == enc.sorting_mode
コード例 #2
0
def test_sorting_mode_label():
    enc = Encyclopaedia()

    for x in range(5):
        EncEntry(
            parent=enc,
            name="Test Name",
            text=["Test Text"],
            subject="Test Subject",
        )

    assert "Number" == enc.labels.sorting_mode

    enc.Sort(Encyclopaedia.SORT_ALPHABETICAL)()
    assert "A to Z" == enc.labels.sorting_mode

    enc.Sort(Encyclopaedia.SORT_REVERSE_ALPHABETICAL)()
    assert "Z to A" == enc.labels.sorting_mode

    enc.Sort(Encyclopaedia.SORT_SUBJECT)()
    assert "Subject" == enc.labels.sorting_mode

    enc.Sort(Encyclopaedia.SORT_UNREAD)()
    assert "Unread" == enc.labels.sorting_mode