Make sure the test cheks for issue 688

This commit is contained in:
Veronica K. B. Olsen
2021-02-23 22:07:14 +01:00
parent fe04c1af25
commit b9d344c7d9
2 changed files with 16 additions and 4 deletions
+1 -1
View File
@@ -717,7 +717,7 @@ class NWIndex():
for refTitle in self._refIndex[tHandle]:
for aTag in self._refIndex[tHandle][refTitle].get("tags", []):
if len(aTag) == 3 and (sTitle is None or sTitle == refTitle):
if aTag[1] in theRefs: # Future-compatible. Check can be removed in 1.2.
if aTag[1] in theRefs:
theRefs[aTag[1]].append(aTag[2])
return theRefs
+15 -3
View File
@@ -198,14 +198,26 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
assert theIndex.scanText(cHandle, (
"# Jane Smith\n"
"@tag: Jane"
"@tag: Jane\n"
))
assert theIndex.scanText(nHandle, (
"# Hello World!\n"
"@pov: Jane"
"@pov: Jane\n"
"@invalid: John\n" # Checks for issue #688
))
assert theIndex._tagIndex == {"Jane": [2, cHandle, "CHARACTER", "T000001"]}
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
assert theIndex.getReferences(nHandle, "T000001") == {
"@char": [],
"@custom": [],
"@entity": [],
"@focus": [],
"@location": [],
"@object": [],
"@plot": [],
"@pov": ["Jane"],
"@time": []
}
assert theIndex.novelChangedSince(0)
assert theIndex.notesChangedSince(0)
@@ -281,7 +293,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI):
"This is a story about Jane Smith.\n\n"
"Well, not really.\n"
))
assert str(theIndex._tagIndex) == "{'Jane': [2, '%s', 'CHARACTER', 'T000001']}" % cHandle
assert theIndex._tagIndex == {"Jane": [2, cHandle, "CHARACTER", "T000001"]}
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
# Check that title sections are indexed properly