From aaf4ede04d78a39e40c413e2e3e7dccb440c018e Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 24 Jun 2025 16:15:49 +0200 Subject: [PATCH] Update test coverage --- tests/test_core/test_core_index.py | 5 ++++- tests/test_core/test_core_indexdata.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_core/test_core_index.py b/tests/test_core/test_core_index.py index dca4575a..e86b8dc0 100644 --- a/tests/test_core/test_core_index.py +++ b/tests/test_core/test_core_index.py @@ -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") == [] diff --git a/tests/test_core/test_core_indexdata.py b/tests/test_core/test_core_indexdata.py index 5bf45c8a..d4797aee 100644 --- a/tests/test_core/test_core_indexdata.py +++ b/tests/test_core/test_core_indexdata.py @@ -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") == []