Make sure the test cheks for issue 688
This commit is contained in:
+1
-1
@@ -717,7 +717,7 @@ class NWIndex():
|
|||||||
for refTitle in self._refIndex[tHandle]:
|
for refTitle in self._refIndex[tHandle]:
|
||||||
for aTag in self._refIndex[tHandle][refTitle].get("tags", []):
|
for aTag in self._refIndex[tHandle][refTitle].get("tags", []):
|
||||||
if len(aTag) == 3 and (sTitle is None or sTitle == refTitle):
|
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])
|
theRefs[aTag[1]].append(aTag[2])
|
||||||
|
|
||||||
return theRefs
|
return theRefs
|
||||||
|
|||||||
@@ -198,14 +198,26 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
|
|||||||
|
|
||||||
assert theIndex.scanText(cHandle, (
|
assert theIndex.scanText(cHandle, (
|
||||||
"# Jane Smith\n"
|
"# Jane Smith\n"
|
||||||
"@tag: Jane"
|
"@tag: Jane\n"
|
||||||
))
|
))
|
||||||
assert theIndex.scanText(nHandle, (
|
assert theIndex.scanText(nHandle, (
|
||||||
"# Hello World!\n"
|
"# 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._tagIndex == {"Jane": [2, cHandle, "CHARACTER", "T000001"]}
|
||||||
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
|
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.novelChangedSince(0)
|
||||||
assert theIndex.notesChangedSince(0)
|
assert theIndex.notesChangedSince(0)
|
||||||
@@ -281,7 +293,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI):
|
|||||||
"This is a story about Jane Smith.\n\n"
|
"This is a story about Jane Smith.\n\n"
|
||||||
"Well, not really.\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!"
|
assert theIndex.getNovelData(nHandle, "T000001")["title"] == "Hello World!"
|
||||||
|
|
||||||
# Check that title sections are indexed properly
|
# Check that title sections are indexed properly
|
||||||
|
|||||||
Reference in New Issue
Block a user