New test for NWDoc class

This commit is contained in:
Veronica K. B. Olsen
2020-12-01 22:19:18 +01:00
parent 2018d44ba8
commit 8cc6fa6030
6 changed files with 218 additions and 93 deletions
-24
View File
@@ -325,30 +325,6 @@ def testProjectMethods(monkeypatch, nwMinimal, dummyGUI):
assert theProject.setBookAuthors(" Jane Doe \n John Doh \n ")
assert theProject.bookAuthors == ["Jane Doe", "John Doh"]
@pytest.mark.project
def testDocMeta(dummyGUI, nwLipsum):
"""Check that the document meta data string is parsed correctly.
"""
theProject = NWProject(dummyGUI)
theProject.projTree.setSeed(42)
assert theProject.openProject(nwLipsum)
aDoc = NWDoc(theProject, dummyGUI)
assert aDoc.openDocument("47666c91c7ccf")
theName, theParent, theClass, theLayout = aDoc.getMeta()
assert theName == "Scene Five"
assert theParent == "6bd935d2490cd"
assert theClass == nwItemClass.NOVEL
assert theLayout == nwItemLayout.SCENE
aDoc._docMeta = {"stuff": None}
theName, theParent, theClass, theLayout = aDoc.getMeta()
assert theName == ""
assert theParent is None
assert theClass is None
assert theLayout is None
@pytest.mark.project
def testSpellEnchant(tmpDir, nwConf):
wList = os.path.join(tmpDir, "wordlist.txt")