Add novel data extraction function to index

This commit is contained in:
Veronica K. B. Olsen
2021-01-02 22:22:05 +01:00
parent a57e8f3a5d
commit acb6f1fc87
3 changed files with 17 additions and 7 deletions
+5 -2
View File
@@ -218,7 +218,7 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
"@pov: Jane"
))
assert theIndex.tagIndex == {"Jane": [2, cHandle, "CHARACTER", "T000001"]}
assert theIndex.novelIndex[nHandle]["T000001"]["title"] == "Hello World!"
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
assert theIndex.novelChangedSince(0)
assert theIndex.notesChangedSince(0)
@@ -294,7 +294,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI):
"Well, not really.\n"
))
assert str(theIndex.tagIndex) == "{'Jane': [2, '%s', 'CHARACTER', 'T000001']}" % cHandle
assert theIndex.novelIndex[nHandle]["T000001"]["title"] == "Hello World!"
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
# Check that title sections are indexed properly
assert theIndex.scanText(nHandle, (
@@ -427,6 +427,9 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
nHandle = theProject.newFile("Hello", nwItemClass.NOVEL, "a508bb932959c")
cHandle = theProject.newFile("Jane", nwItemClass.CHARACTER, "afb3043c7b2b3")
assert theIndex.getNovelData("", "") is None
assert theIndex.getNovelData("a508bb932959c", "") is None
assert theIndex.scanText(cHandle, (
"# Jane Smith\n"
"@tag: Jane\n"