Add some clear data functions

This commit is contained in:
Veronica Berglyd Olsen
2024-11-22 00:44:14 +01:00
parent ffe6cd0a65
commit a64ed405f3
8 changed files with 29 additions and 15 deletions
+5 -5
View File
@@ -90,7 +90,7 @@ def testCoreIndex_LoadSave(qtbot, monkeypatch, prjLipsum, mockGUI, tstPaths):
assert index._itemIndex["4c4f28287af27"] is None
# Clear the index
index.clearIndex()
index.clear()
assert index._tagsIndex._tags == {}
assert index._itemIndex._items == {}
@@ -113,8 +113,8 @@ def testCoreIndex_LoadSave(qtbot, monkeypatch, prjLipsum, mockGUI, tstPaths):
assert str(index._itemIndex.packData()) == itemsIndex
# Rebuild index
index.clearIndex()
index.rebuildIndex()
index.clear()
index.rebuild()
assert str(index._tagsIndex.packData()) == tagIndex
assert str(index._itemIndex.packData()) == itemsIndex
@@ -221,7 +221,7 @@ def testCoreIndex_CheckThese(mockGUI, fncPath, mockRnd):
mockRnd.reset()
buildTestProject(project, fncPath)
index = project.index
index.clearIndex()
index.clear()
nHandle = project.newFile("Hello", C.hNovelRoot)
cHandle = project.newFile("Jane", C.hCharRoot)
@@ -1155,7 +1155,7 @@ def testCoreIndex_ItemIndex(mockGUI, fncPath, mockRnd):
project = NWProject()
mockRnd.reset()
buildTestProject(project, fncPath)
project.index.clearIndex()
project.index.clear()
nHandle = C.hTitlePage
cHandle = C.hChapterDoc
+4 -4
View File
@@ -87,11 +87,11 @@ def testGuiViewerPanel_BackRefs(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
assert item.text(tabBackRefs.C_TITLE) == "Scene One"
# Clear Index
SHARED.project.index.clearIndex()
SHARED.project.index.clear()
assert tabBackRefs.topLevelItemCount() == 0
# Rebuild Index
SHARED.project.index.rebuildIndex()
SHARED.project.index.rebuild()
assert tabBackRefs.topLevelItemCount() == 1
# Test Update Theme
@@ -182,11 +182,11 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
assert item.text(charTab.C_TITLE) == "Jane Smith"
# Clear Index
SHARED.project.index.clearIndex()
SHARED.project.index.clear()
assert charTab.topLevelItemCount() == 0
# Rebuild Index
SHARED.project.index.rebuildIndex()
SHARED.project.index.rebuild()
assert charTab.topLevelItemCount() == 2
# Test Update Theme