Update test coverage

This commit is contained in:
Veronica Berglyd Olsen
2025-06-24 16:15:49 +02:00
parent 5ae385ec02
commit aaf4ede04d
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -695,6 +695,7 @@ def testCoreIndex_ExtractData(nwGUI, fncPath, mockRnd):
))
assert index.scanText(nHandle, (
"# Hello World!\n"
"@tag: Scene\n"
"@pov: Jane\n"
"@char: Jane, John\n\n"
"% this is a comment\n\n"
@@ -749,11 +750,13 @@ def testCoreIndex_ExtractData(nwGUI, fncPath, mockRnd):
# Look up an invalid handle
refs = index.getReferences("Not a handle")
assert refs["@tag"] == []
assert refs["@pov"] == []
assert refs["@char"] == []
# The novel file should now refer to Jane as @pov and @char
refs = index.getReferences(nHandle)
assert refs["@tag"] == ["Scene"]
assert refs["@pov"] == ["Jane"]
assert refs["@char"] == ["Jane", "John"]
@@ -791,7 +794,7 @@ def testCoreIndex_ExtractData(nwGUI, fncPath, mockRnd):
# getKeyWordTags
# ==============
assert index.getKeyWordTags("@mention") == ["Jane", "John"]
assert index.getKeyWordTags("@mention") == ["Jane", "John", "Scene"]
assert index.getKeyWordTags("@char") == ["Jane", "John"]
assert index.getKeyWordTags("@plot") == []
assert index.getKeyWordTags("@tag") == []
+4 -2
View File
@@ -267,6 +267,7 @@ def testCoreIndexData_IndexHeadingReferences():
head = IndexHeading(cache, "T0001")
# Add some references
head.setTag("Scene")
head.addReference("Jane", "@pov")
head.addReference("Jane", "@char")
head.addReference("John", "@char")
@@ -290,6 +291,7 @@ def testCoreIndexData_IndexHeadingReferences():
}
# Set names
cache.tags.add("Scene", "Scene", "0000000000000", "T00001", "NOVEL")
cache.tags.add("Jane", "Jane", "0000000000000", "T00001", "CHARACTER")
cache.tags.add("John", "John", "0000000000000", "T00001", "CHARACTER")
cache.tags.add("Main", "Main", "0000000000000", "T00001", "PLOT")
@@ -301,7 +303,7 @@ def testCoreIndexData_IndexHeadingReferences():
"@plot": ["Main"],
"@object": ["Gun"],
"@story": [],
"@tag": [],
"@tag": ["Scene"],
"@focus": [],
"@custom": [],
"@time": [],
@@ -316,7 +318,7 @@ def testCoreIndexData_IndexHeadingReferences():
assert head.getReferencesByKeyword("@plot") == ["Main"]
assert head.getReferencesByKeyword("@object") == ["Gun"]
assert head.getReferencesByKeyword("@story") == []
assert head.getReferencesByKeyword("@tag") == []
assert head.getReferencesByKeyword("@tag") == ["Scene"]
assert head.getReferencesByKeyword("@focus") == []
assert head.getReferencesByKeyword("@custom") == []
assert head.getReferencesByKeyword("@time") == []