From c70023c066b90afd3184a23ce0f5504f84dc61a6 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 24 Jan 2021 22:49:23 +0100 Subject: [PATCH] Fix tests --- tests/test_core/test_core_index.py | 12 ++++++------ tests/test_gui/test_gui_projdetails.py | 24 +++++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/test_core/test_core_index.py b/tests/test_core/test_core_index.py index 46396574..e10000d6 100644 --- a/tests/test_core/test_core_index.py +++ b/tests/test_core/test_core_index.py @@ -659,18 +659,18 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI): assert theIndex.getTableOfContents(0, True) == [] assert theIndex.getTableOfContents(1, True) == [] assert theIndex.getTableOfContents(2, True) == [ - ("%s:T000001" % hHandle, "H2", "Chapter One", 6), + ("%s:T000001" % hHandle, 2, "Chapter One", 6), ] assert theIndex.getTableOfContents(3, True) == [ - ("%s:T000001" % hHandle, "H2", "Chapter One", 2), - ("%s:T000001" % sHandle, "H3", "Scene One", 2), - ("%s:T000001" % tHandle, "H3", "Scene Two", 2), + ("%s:T000001" % hHandle, 2, "Chapter One", 2), + ("%s:T000001" % sHandle, 3, "Scene One", 2), + ("%s:T000001" % tHandle, 3, "Scene Two", 2), ] assert theIndex.getTableOfContents(0, False) == [] assert theIndex.getTableOfContents(1, False) == [ - ("%s:T000001" % nHandle, "H1", "Hello World!", 12), - ("%s:T000011" % nHandle, "H1", "Hello World!", 18), + ("%s:T000001" % nHandle, 1, "Hello World!", 12), + ("%s:T000011" % nHandle, 1, "Hello World!", 18), ] assert theProject.closeProject() diff --git a/tests/test_gui/test_gui_projdetails.py b/tests/test_gui/test_gui_projdetails.py index 179b6d04..b2e06270 100644 --- a/tests/test_gui/test_gui_projdetails.py +++ b/tests/test_gui/test_gui_projdetails.py @@ -78,31 +78,33 @@ def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum): tocTree = tocTab.tocTree assert tocTree.topLevelItemCount() == 7 assert tocTree.topLevelItem(0).text(tocTab.C_TITLE) == "Lorem Ipsum" - assert tocTree.topLevelItem(2).text(tocTab.C_TITLE) == nwUnicode.U_ENSP+"Prologue" + assert tocTree.topLevelItem(2).text(tocTab.C_TITLE) == "Prologue" assert tocTree.topLevelItem(3).text(tocTab.C_TITLE) == "Act One" - assert tocTree.topLevelItem(4).text(tocTab.C_TITLE) == nwUnicode.U_ENSP+"Chapter One" - assert tocTree.topLevelItem(5).text(tocTab.C_TITLE) == nwUnicode.U_ENSP+"Chapter Two" + assert tocTree.topLevelItem(4).text(tocTab.C_TITLE) == "Chapter One" + assert tocTree.topLevelItem(5).text(tocTab.C_TITLE) == "Chapter Two" assert tocTree.topLevelItem(6).text(tocTab.C_TITLE) == "END" # Count Pages tocTab.wpValue.setValue(100) + tocTab.poValue.setValue(4) tocTab.dblValue.setChecked(False) tocTab._populateTree() - thePages = [1, 2, 1, 1, 11, 17, 0] - thePage = [1, 2, 4, 5, 6, 17, 34] + thePages = ["1", "2", "1", "1", "11", "17", "0"] + thePage = ["i", "ii", "1", "2", "3", "14", "31"] for i in range(7): - assert tocTree.topLevelItem(i).text(tocTab.C_PAGES) == f"{thePages[i]:n}" - assert tocTree.topLevelItem(i).text(tocTab.C_PAGE) == f"{thePage[i]:n}" + assert tocTree.topLevelItem(i).text(tocTab.C_PAGES) == thePages[i] + assert tocTree.topLevelItem(i).text(tocTab.C_PAGE) == thePage[i] + tocTab.poValue.setValue(5) tocTab.dblValue.setChecked(True) tocTab._populateTree() - thePages = [2, 2, 2, 2, 12, 18, 0] - thePage = [1, 3, 5, 7, 9, 21, 39] + thePages = ["2", "2", "2", "2", "12", "18", "0"] + thePage = ["i", "iii", "1", "3", "5", "17", "35"] for i in range(7): - assert tocTree.topLevelItem(i).text(tocTab.C_PAGES) == f"{thePages[i]:n}" - assert tocTree.topLevelItem(i).text(tocTab.C_PAGE) == f"{thePage[i]:n}" + assert tocTree.topLevelItem(i).text(tocTab.C_PAGES) == thePages[i] + assert tocTree.topLevelItem(i).text(tocTab.C_PAGE) == thePage[i] # qtbot.stopForInteraction()