Пример #1
0
def test_sub_sub_list_improper_formatting():

    answers = [["level3"], "level2", ["level3", ["level4"]]]
    a = AnkiNoteBuilder()
    answerString = a.createAnswerString({}, answers)

    assert (
        answerString ==
        "<ul style='list-style-position: inside;'><ul style='list-style-position: inside;'><li>level3</li></ul><li>level2</li><ul style='list-style-position: inside;'><li>level3</li><ul style='list-style-position: inside;'><li>level4</li></ul></ul></ul>"
    )
Пример #2
0
def testBuildNoteForSublists():

    answers = [
        "first answer", ["sublist 1", ["sublist2"], "back to sublist1"],
        "second answer"
    ]
    a = AnkiNoteBuilder()
    answerString = a.createAnswerString({}, answers)

    expectedString = "<ul style='list-style-position: inside;'><li>first answer</li><ul style='list-style-position: inside;'><li>sublist 1</li><ul style='list-style-position: inside;'><li>sublist2</li></ul><li>back to sublist1</li></ul><li>second answer</li></ul>"
    assert (answerString == expectedString)