Remove all END Test comments
This commit is contained in:
@@ -21,20 +21,21 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import pytest
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from tools import C, buildTestProject
|
||||
from mocked import causeOSError
|
||||
import pytest
|
||||
|
||||
from novelwriter.enum import nwBuildFmt, nwItemClass
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.buildsettings import BuildCollection, BuildSettings, FilterMode
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.enum import nwBuildFmt, nwItemClass
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
def isUUID(value):
|
||||
@@ -140,8 +141,6 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
|
||||
assert more["build"] == "Build Name"
|
||||
assert more["format"] == nwBuildFmt.HTML.name
|
||||
|
||||
# END Test testCoreBuildSettings_ClassAttributes
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreBuildSettings_BuildValues():
|
||||
@@ -216,8 +215,6 @@ def testCoreBuildSettings_BuildValues():
|
||||
assert more["settings"][boolSetting] is True
|
||||
assert more["settings"][floatSetting] == 2.5
|
||||
|
||||
# END Test testCoreBuildSettings_BuildValues
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreBuildSettings_Filters(mockGUI, fncPath: Path, mockRnd):
|
||||
@@ -364,8 +361,6 @@ def testCoreBuildSettings_Filters(mockGUI, fncPath: Path, mockRnd):
|
||||
# No valid project provided
|
||||
assert build.buildItemFilter(None) == {} # type: ignore
|
||||
|
||||
# END Test testCoreBuildSettings_Filters
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreBuildSettings_Collection(monkeypatch, mockGUI, fncPath: Path, mockRnd):
|
||||
@@ -471,5 +466,3 @@ def testCoreBuildSettings_Collection(monkeypatch, mockGUI, fncPath: Path, mockRn
|
||||
]
|
||||
assert another.lastBuild == buildIDOne
|
||||
assert another.defaultBuild == buildIDTwo
|
||||
|
||||
# END Test testCoreBuildSettings_Collection
|
||||
|
||||
@@ -125,8 +125,6 @@ def testCoreTools_DocMerger(monkeypatch, mockGUI, fncPath, tstPaths, mockRnd, ip
|
||||
# Just for debugging
|
||||
docMerger.writeTargetDoc()
|
||||
|
||||
# END Test testCoreTools_DocMerger
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_DocSplitter(monkeypatch, mockGUI, fncPath, mockRnd, ipsumText):
|
||||
@@ -264,8 +262,6 @@ def testCoreTools_DocSplitter(monkeypatch, mockGUI, fncPath, mockRnd, ipsumText)
|
||||
|
||||
project.saveProject()
|
||||
|
||||
# END Test testCoreTools_DocSplitter
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_DocDuplicator(mockGUI, fncPath, tstPaths, mockRnd):
|
||||
@@ -401,8 +397,6 @@ def testCoreTools_DocDuplicator(mockGUI, fncPath, tstPaths, mockRnd):
|
||||
copyfile(projFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
# END Test testCoreTools_DocDuplicator
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_DocSearch(monkeypatch, mockGUI, fncPath, mockRnd, ipsumText):
|
||||
@@ -479,8 +473,6 @@ def testCoreTools_DocSearch(monkeypatch, mockGUI, fncPath, mockRnd, ipsumText):
|
||||
assert pruneResult(search.iterSearch(project, "Lorem"), 2) == [(15, 5, "Lorem")]
|
||||
search.setCaseSensitive(False)
|
||||
|
||||
# END Test testCoreTools_DocSearch
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderWrapper(monkeypatch, caplog, fncPath, mockGUI):
|
||||
@@ -509,8 +501,6 @@ def testCoreTools_ProjectBuilderWrapper(monkeypatch, caplog, fncPath, mockGUI):
|
||||
assert builder.buildProject({"path": fncPath}) is False
|
||||
assert "The target folder is not empty." in caplog.text
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderWrapper
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderA(monkeypatch, fncPath, tstPaths, mockGUI, mockRnd):
|
||||
@@ -544,8 +534,6 @@ def testCoreTools_ProjectBuilderA(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
copyfile(projFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderA
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderB(monkeypatch, fncPath, tstPaths, mockGUI, mockRnd):
|
||||
@@ -579,8 +567,6 @@ def testCoreTools_ProjectBuilderB(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
copyfile(projFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderB
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderCopyPlain(monkeypatch, caplog, mockGUI, prjLipsum, fncPath):
|
||||
@@ -645,8 +631,6 @@ def testCoreTools_ProjectBuilderCopyPlain(monkeypatch, caplog, mockGUI, prjLipsu
|
||||
assert dstProject.data.autoCount < 5
|
||||
assert dstProject.data.editTime < 10
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderCopyPlain
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderCopyZipped(monkeypatch, caplog, mockGUI, fncPath, mockRnd):
|
||||
@@ -723,8 +707,6 @@ def testCoreTools_ProjectBuilderCopyZipped(monkeypatch, caplog, mockGUI, fncPath
|
||||
assert dstProject.data.autoCount < 5
|
||||
assert dstProject.data.editTime < 10
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderCopyZipped
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderSample(monkeypatch, mockGUI, fncPath, tstPaths):
|
||||
@@ -769,5 +751,3 @@ def testCoreTools_ProjectBuilderSample(monkeypatch, mockGUI, fncPath, tstPaths):
|
||||
# Can't create to the same target again
|
||||
assert builder.buildProject(data) is False
|
||||
dstSample.unlink()
|
||||
|
||||
# END Test testCoreTools_ProjectBuilderSample
|
||||
|
||||
@@ -182,8 +182,6 @@ def testCoreDocBuild_OpenDocument(monkeypatch, mockGUI, prjLipsum, fncPath, tstP
|
||||
"Build: Failed to build '04468803b92e1'",
|
||||
]
|
||||
|
||||
# END Test testCoreDocBuild_OpenDocument
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocBuild_HTML(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
|
||||
@@ -252,8 +250,6 @@ def testCoreDocBuild_HTML(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
|
||||
assert docBuild.error == "OSError: Mock OSError"
|
||||
assert not docFile.is_file()
|
||||
|
||||
# END Test testCoreDocBuild_HTML
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocBuild_Markdown(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
|
||||
@@ -322,8 +318,6 @@ def testCoreDocBuild_Markdown(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths
|
||||
assert docBuild.error == "OSError: Mock OSError"
|
||||
assert not docFile.is_file()
|
||||
|
||||
# END Test testCoreDocBuild_Markdown
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocBuild_NWD(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
|
||||
@@ -392,8 +386,6 @@ def testCoreDocBuild_NWD(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
|
||||
assert docBuild.error == "OSError: Mock OSError"
|
||||
assert not docFile.is_file()
|
||||
|
||||
# END Test testCoreDocBuild_NWD
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocBuild_Custom(mockGUI, fncPath: Path):
|
||||
@@ -457,8 +449,6 @@ def testCoreDocBuild_Custom(mockGUI, fncPath: Path):
|
||||
)
|
||||
docFile.unlink()
|
||||
|
||||
# END Test testCoreDocBuild_Custom
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocBuild_IterBuild(mockGUI, fncPath: Path, mockRnd):
|
||||
@@ -600,5 +590,3 @@ def testCoreDocBuild_IterBuild(mockGUI, fncPath: Path, mockRnd):
|
||||
assert "meta" in data
|
||||
assert "text" in data
|
||||
docFile.unlink()
|
||||
|
||||
# END Test testCoreDocBuild_IterBuild
|
||||
|
||||
@@ -22,12 +22,12 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tools import C, MOCK_TIME, buildTestProject, readFile, writeFile
|
||||
from mocked import causeOSError
|
||||
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.document import NWDocument
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import MOCK_TIME, C, buildTestProject, readFile, writeFile
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
@@ -189,8 +189,6 @@ def testCoreDocument_LoadSave(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
assert doc.deleteDocument() is True
|
||||
assert not docPath.exists()
|
||||
|
||||
# END Test testCoreDocument_Load
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreDocument_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
@@ -234,5 +232,3 @@ def testCoreDocument_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
)
|
||||
|
||||
assert doc.readDocument() == "### Test File\n\nText ...\n\n"
|
||||
|
||||
# END Test testCoreDocument_Methods
|
||||
|
||||
@@ -156,8 +156,6 @@ def testCoreIndex_LoadSave(qtbot, monkeypatch, prjLipsum, mockGUI, tstPaths):
|
||||
# Regression test for issue #1718
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreIndex_LoadSave
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_ScanThis(mockGUI):
|
||||
@@ -214,8 +212,6 @@ def testCoreIndex_ScanThis(mockGUI):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreIndex_ScanThis
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_CheckThese(mockGUI, fncPath, mockRnd):
|
||||
@@ -305,8 +301,6 @@ def testCoreIndex_CheckThese(mockGUI, fncPath, mockRnd):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreIndex_CheckThese
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_ScanText(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
@@ -550,8 +544,6 @@ def testCoreIndex_ScanText(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreIndex_ScanText
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_CommentKeys(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
@@ -589,8 +581,6 @@ def testCoreIndex_CommentKeys(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
# Check invalid comment style
|
||||
assert index.newCommentKey(C.hSceneDoc, None) == "err" # type: ignore
|
||||
|
||||
# END Test testCoreIndex_CommentKeys
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
|
||||
@@ -931,8 +921,6 @@ def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
|
||||
assert project.saveProject() is True
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreIndex_ExtractData
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_TagsIndex():
|
||||
@@ -1119,8 +1107,6 @@ def testCoreIndex_TagsIndex():
|
||||
}
|
||||
})
|
||||
|
||||
# END Test testCoreIndex_TagsIndex
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_ItemIndex(mockGUI, fncPath, mockRnd):
|
||||
@@ -1391,8 +1377,6 @@ def testCoreIndex_ItemIndex(mockGUI, fncPath, mockRnd):
|
||||
}
|
||||
})
|
||||
|
||||
# END Test testCoreIndex_ItemIndex
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_checkModKey():
|
||||
@@ -1425,8 +1409,6 @@ def testCoreIndex_checkModKey():
|
||||
assert _checkModKey("note", "a1.2") is False
|
||||
assert _checkModKey("note", "a1_2") is True
|
||||
|
||||
# END Test testCoreIndex_checkModKey
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreIndex_processComment():
|
||||
@@ -1477,5 +1459,3 @@ def testCoreIndex_processComment():
|
||||
assert processComment("% note.term: Hi") == (nwComment.NOTE, "term", "Hi", 7, 12)
|
||||
assert processComment("% note. term : Hi") == (nwComment.PLAIN, "", "note. term : Hi", 0, 0)
|
||||
assert processComment("% note . term : Hi") == (nwComment.PLAIN, "", "note . term : Hi", 0, 0)
|
||||
|
||||
# END Test testCoreIndex_processComment
|
||||
|
||||
@@ -21,15 +21,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QIcon
|
||||
|
||||
from tools import C, buildTestProject
|
||||
|
||||
from novelwriter.enum import nwItemClass, nwItemType, nwItemLayout
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
|
||||
from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
@@ -180,8 +181,6 @@ def testCoreItem_Setters(mockGUI, mockRnd, fncPath):
|
||||
item.saveInitialCount()
|
||||
assert item.initCount == 234
|
||||
|
||||
# END Test testCoreItem_Setters
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_Methods(mockGUI, mockRnd, fncPath):
|
||||
@@ -326,8 +325,6 @@ def testCoreItem_Methods(mockGUI, mockRnd, fncPath):
|
||||
del scItem
|
||||
assert cpItem.pack() == cpData
|
||||
|
||||
# END Test testCoreItem_Methods
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_TypeSetter(mockGUI):
|
||||
@@ -355,8 +352,6 @@ def testCoreItem_TypeSetter(mockGUI):
|
||||
item.setType(nwItemType.ROOT)
|
||||
assert item.itemType == nwItemType.ROOT
|
||||
|
||||
# END Test testCoreItem_TypeSetter
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_ClassSetter(mockGUI):
|
||||
@@ -461,8 +456,6 @@ def testCoreItem_ClassSetter(mockGUI):
|
||||
item.setClass(nwItemClass.NOVEL)
|
||||
assert item.itemClass == nwItemClass.NOVEL
|
||||
|
||||
# END Test testCoreItem_ClassSetter
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_LayoutSetter(mockGUI):
|
||||
@@ -490,8 +483,6 @@ def testCoreItem_LayoutSetter(mockGUI):
|
||||
item.setLayout(nwItemLayout.NOTE)
|
||||
assert item.itemLayout == nwItemLayout.NOTE
|
||||
|
||||
# END Test testCoreItem_LayoutSetter
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_ClassDefaults(mockGUI):
|
||||
@@ -546,8 +537,6 @@ def testCoreItem_ClassDefaults(mockGUI):
|
||||
assert item.itemStatus is not None
|
||||
assert item.itemImport is not None
|
||||
|
||||
# END Test testCoreItem_ClassDefaults
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreItem_PackUnpack(mockGUI, caplog, mockRnd):
|
||||
@@ -761,5 +750,3 @@ def testCoreItem_PackUnpack(mockGUI, caplog, mockRnd):
|
||||
"import": "i000001",
|
||||
}
|
||||
}
|
||||
|
||||
# END Test testCoreItem_PackUnpack
|
||||
|
||||
@@ -21,15 +21,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import pytest
|
||||
|
||||
from mocked import causeOSError
|
||||
import pytest
|
||||
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.options import OptionState
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.gui.noveltree import NovelTreeColumn
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreOptions_LoadSave(monkeypatch, mockGUI, fncPath):
|
||||
@@ -102,8 +103,6 @@ def testCoreOptions_LoadSave(monkeypatch, mockGUI, fncPath):
|
||||
},
|
||||
}
|
||||
|
||||
# END Test testCoreOptions_LoadSave
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreOptions_SetGet(mockGUI):
|
||||
@@ -151,5 +150,3 @@ def testCoreOptions_SetGet(mockGUI):
|
||||
assert options.getFloat("SomeGroup", "mockItem", None) is None # type: ignore
|
||||
assert options.getBool("SomeGroup", "mockItem", None) is None # type: ignore
|
||||
assert options.getEnum("SomeGroup", "mockItem", NovelTreeColumn, None) is None # type: ignore
|
||||
|
||||
# END Test testCoreOptions_SetGet
|
||||
|
||||
@@ -20,25 +20,25 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from shutil import copyfile
|
||||
from zipfile import ZipFile
|
||||
|
||||
from mocked import causeOSError
|
||||
from tools import C, cmpFiles, buildTestProject, XML_IGNORE
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.enum import nwItemClass
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.tree import NWTree
|
||||
from novelwriter.core.index import NWIndex
|
||||
from novelwriter.core.project import NWProject, NWProjectState
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.options import OptionState
|
||||
from novelwriter.core.project import NWProject, NWProjectState
|
||||
from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter, XMLReadState
|
||||
from novelwriter.core.tree import NWTree
|
||||
from novelwriter.enum import nwItemClass
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import XML_IGNORE, C, buildTestProject, cmpFiles
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
@@ -88,8 +88,6 @@ def testCoreProject_NewRoot(fncPath, tstPaths, mockGUI, mockRnd):
|
||||
assert "0000000000016" not in project.tree
|
||||
assert "0000000000017" not in project.tree
|
||||
|
||||
# END Test testCoreProject_NewRoot
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_NewFileFolder(monkeypatch, fncPath, tstPaths, mockGUI, mockRnd):
|
||||
@@ -192,8 +190,6 @@ def testCoreProject_NewFileFolder(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreProject_NewFileFolder
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_Open(monkeypatch, caplog, mockGUI, fncPath, mockRnd):
|
||||
@@ -302,8 +298,6 @@ def testCoreProject_Open(monkeypatch, caplog, mockGUI, fncPath, mockRnd):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreProject_Open
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_Save(monkeypatch, mockGUI, mockRnd, fncPath):
|
||||
@@ -331,8 +325,6 @@ def testCoreProject_Save(monkeypatch, mockGUI, mockRnd, fncPath):
|
||||
assert project.saveProject(autoSave=True) is True
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreProject_Save
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_AccessItems(mockGUI, fncPath, mockRnd):
|
||||
@@ -397,8 +389,6 @@ def testCoreProject_AccessItems(mockGUI, fncPath, mockRnd):
|
||||
]
|
||||
assert nItem.itemParent is None
|
||||
|
||||
# END Test testCoreProject_AccessItems
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
@@ -507,8 +497,6 @@ def testCoreProject_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
project.setTreeOrder(oldOrder)
|
||||
assert project.tree.handles() == oldOrder
|
||||
|
||||
# END Test testCoreProject_Methods
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProject_Backup(monkeypatch, mockGUI, fncPath, tstPaths):
|
||||
@@ -566,5 +554,3 @@ def testCoreProject_Backup(monkeypatch, mockGUI, fncPath, tstPaths):
|
||||
fncPath / "nwProject.nwx",
|
||||
tstPaths.tmpDir / "extract" / "nwProject.nwx"
|
||||
)
|
||||
|
||||
# END Test testCoreProject_Backup
|
||||
|
||||
@@ -246,8 +246,6 @@ def testCoreProjectXML_ReadCurrent(monkeypatch, mockGUI, tstPaths, fncPath):
|
||||
copyfile(outFile, tstFile)
|
||||
assert cmpFiles(tstFile, refFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadCurrent
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProjectXML_ReadLegacy10(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
@@ -393,8 +391,6 @@ def testCoreProjectXML_ReadLegacy10(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
copyfile(outFile, testFile)
|
||||
assert cmpFiles(testFile, compFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadLegacy10
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProjectXML_ReadLegacy11(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
@@ -540,8 +536,6 @@ def testCoreProjectXML_ReadLegacy11(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
copyfile(outFile, testFile)
|
||||
assert cmpFiles(testFile, compFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadLegacy11
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProjectXML_ReadLegacy12(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
@@ -690,8 +684,6 @@ def testCoreProjectXML_ReadLegacy12(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
copyfile(outFile, testFile)
|
||||
assert cmpFiles(testFile, compFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadLegacy12
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProjectXML_ReadLegacy13(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
@@ -840,8 +832,6 @@ def testCoreProjectXML_ReadLegacy13(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
copyfile(outFile, testFile)
|
||||
assert cmpFiles(testFile, compFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadLegacy13
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreProjectXML_ReadLegacy14(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
@@ -990,5 +980,3 @@ def testCoreProjectXML_ReadLegacy14(tstPaths, fncPath, mockGUI, mockRnd):
|
||||
compFile = tstPaths.refDir / "projectXML_ReadLegacy14.nwx"
|
||||
copyfile(outFile, testFile)
|
||||
assert cmpFiles(testFile, compFile)
|
||||
|
||||
# END Test testCoreProjectXML_ReadLegacy14
|
||||
|
||||
@@ -20,18 +20,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from time import sleep
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
|
||||
from tools import buildTestProject
|
||||
from mocked import causeOSError
|
||||
import pytest
|
||||
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.sessions import NWSessionLog
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreSessions_Main(monkeypatch, mockGUI, fncPath):
|
||||
@@ -111,5 +111,3 @@ def testCoreSessions_Main(monkeypatch, mockGUI, fncPath):
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("novelwriter.core.storage.NWStorage.getMetaFile", lambda *a: None)
|
||||
assert len(list(sessLog.iterRecords())) == 0
|
||||
|
||||
# END Test testCoreSessions_Main
|
||||
|
||||
@@ -21,18 +21,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import pytest
|
||||
import enchant
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from tools import buildTestProject
|
||||
from mocked import causeOSError
|
||||
import enchant
|
||||
import pytest
|
||||
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.spellcheck import FakeEnchant, NWSpellEnchant, UserDictionary
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreSpell_UserDictionary(monkeypatch, mockGUI, fncPath):
|
||||
@@ -102,8 +103,6 @@ def testCoreSpell_UserDictionary(monkeypatch, mockGUI, fncPath):
|
||||
userDict.load()
|
||||
assert sorted(userDict) == ["bar", "foo"]
|
||||
|
||||
# END Test testCoreSpell_UserDictionary
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreSpell_FakeEnchant(monkeypatch, mockGUI, fncPath):
|
||||
@@ -137,8 +136,6 @@ def testCoreSpell_FakeEnchant(monkeypatch, mockGUI, fncPath):
|
||||
assert fkChk.suggest("whatchamajig") == []
|
||||
assert fkChk.add_to_session("whatchamajig") is None
|
||||
|
||||
# END Test testCoreSpell_FakeEnchant
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreSpell_Enchant(monkeypatch, mockGUI, fncPath):
|
||||
@@ -189,5 +186,3 @@ def testCoreSpell_Enchant(monkeypatch, mockGUI, fncPath):
|
||||
mp.setattr("enchant.Broker.request_dict", lambda *a: None)
|
||||
spChk.setLanguage("en_US")
|
||||
assert isinstance(spChk._enchant, FakeEnchant)
|
||||
|
||||
# END Test testCoreSpell_Enchant
|
||||
|
||||
@@ -22,13 +22,13 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tools import C
|
||||
|
||||
from PyQt5.QtGui import QColor, QIcon
|
||||
|
||||
from novelwriter.core.status import NWStatus, StatusEntry, _ShapeCache
|
||||
from novelwriter.enum import nwStatusShape
|
||||
|
||||
from tests.tools import C
|
||||
|
||||
statusKeys = [C.sNew, C.sNote, C.sDraft, C.sFinished]
|
||||
importKeys = [C.iNew, C.iMinor, C.iMajor, C.iMain]
|
||||
|
||||
@@ -59,8 +59,6 @@ def testCoreStatus_StatusEntry():
|
||||
assert other.icon is not icon # Not the same icon, but a copy
|
||||
assert other.count == 42
|
||||
|
||||
# END Test testCoreStatus_StatusEntry
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStatus_Internal(mockGUI, mockRnd):
|
||||
@@ -116,8 +114,6 @@ def testCoreStatus_Internal(mockGUI, mockRnd):
|
||||
assert nImport._checkKey("s654321") == "i00000b" # Status key not accepted
|
||||
assert nImport._checkKey("i123456") == "i123456" # Import key accepted
|
||||
|
||||
# END Test testCoreStatus_Internal
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStatus_Iterator(mockGUI, mockRnd):
|
||||
@@ -162,8 +158,6 @@ def testCoreStatus_Iterator(mockGUI, mockRnd):
|
||||
# Content : Count
|
||||
assert [e.count for _, e in nStatus.iterItems()] == [0, 1, 2, 3]
|
||||
|
||||
# END Test testCoreStatus_Iterator
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStatus_Entries(mockGUI, mockRnd):
|
||||
@@ -309,8 +303,6 @@ def testCoreStatus_Entries(mockGUI, mockRnd):
|
||||
assert list(nStatus._store.keys()) == [statusKeys[3], statusKeys[2]]
|
||||
assert nStatus._default == statusKeys[3]
|
||||
|
||||
# END Test testCoreStatus_Entries
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStatus_Pack(mockGUI, mockRnd):
|
||||
@@ -362,8 +354,6 @@ def testCoreStatus_Pack(mockGUI, mockRnd):
|
||||
}),
|
||||
]
|
||||
|
||||
# END Test testCoreStatus_Pack
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStatus_ShapeCache():
|
||||
@@ -413,5 +403,3 @@ def testCoreStatus_ShapeCache():
|
||||
assert shapes.getShape(nwStatusShape.BLOCK_2) is block2
|
||||
assert shapes.getShape(nwStatusShape.BLOCK_3) is block3
|
||||
assert shapes.getShape(nwStatusShape.BLOCK_4) is block4
|
||||
|
||||
# END Test testCoreStatus_ShapeCache
|
||||
|
||||
@@ -21,20 +21,21 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import pytest
|
||||
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
|
||||
from mocked import causeOSError
|
||||
from tools import C, buildTestProject
|
||||
import pytest
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.document import NWDocument
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter
|
||||
from novelwriter.core.storage import NWStorage, NWStorageOpen, NWStorageCreate, _LegacyStorage
|
||||
from novelwriter.core.storage import NWStorage, NWStorageCreate, NWStorageOpen, _LegacyStorage
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
class MockProject:
|
||||
@@ -82,8 +83,6 @@ def testCoreStorage_CreateNewProject(mockGUI, fncPath):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreStorage_CreateNewProject
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_InitProjectStorage(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
@@ -163,8 +162,6 @@ def testCoreStorage_InitProjectStorage(monkeypatch, mockGUI, fncPath, mockRnd):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreStorage_InitProjectStorage
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_InitProjectStorage_Invalid(mockGUI, fncPath):
|
||||
@@ -202,8 +199,6 @@ def testCoreStorage_InitProjectStorage_Invalid(mockGUI, fncPath):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreStorage_InitProjectStorage_Invalid
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_LockFile(monkeypatch, fncPath):
|
||||
@@ -265,8 +260,6 @@ def testCoreStorage_LockFile(monkeypatch, fncPath):
|
||||
assert storage._clearLockFile() is True
|
||||
assert not lockFilePath.exists()
|
||||
|
||||
# END Test testCoreStorage_LockFile
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_ZipIt(monkeypatch, mockGUI, fncPath, tstPaths, mockRnd):
|
||||
@@ -301,8 +294,6 @@ def testCoreStorage_ZipIt(monkeypatch, mockGUI, fncPath, tstPaths, mockRnd):
|
||||
|
||||
project.closeProject()
|
||||
|
||||
# END Test testCoreStorage_ZipIt
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_LegacyDataFolder(monkeypatch, fncPath):
|
||||
@@ -369,8 +360,6 @@ def testCoreStorage_LegacyDataFolder(monkeypatch, fncPath):
|
||||
for c in "0123456789abcdef":
|
||||
assert (fncPath / "content" / f"{c}00000000000{c}.nwd").exists()
|
||||
|
||||
# END Test testCoreStorage_LegacyDataFolder
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_DeprecatedFiles(monkeypatch, fncPath):
|
||||
@@ -412,8 +401,6 @@ def testCoreStorage_DeprecatedFiles(monkeypatch, fncPath):
|
||||
for depFile in remove:
|
||||
assert not depFile.exists()
|
||||
|
||||
# END Test testCoreStorage_DeprecatedFiles
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreStorage_OldFormatConvert(monkeypatch, mockGUI, fncPath):
|
||||
@@ -529,5 +516,3 @@ def testCoreStorage_OldFormatConvert(monkeypatch, mockGUI, fncPath):
|
||||
"LABEL": [False, 267],
|
||||
"LINE": [True, 40]
|
||||
}
|
||||
|
||||
# END Test testCoreStorage_OldFormatConvert
|
||||
|
||||
@@ -129,8 +129,6 @@ def testCoreToHtml_ConvertHeaders(mockGUI):
|
||||
html.doConvert()
|
||||
assert html.result == "<h2><a name='0000000000000:T0001'></a>Heading Two</h2>\n"
|
||||
|
||||
# END Test testCoreToHtml_ConvertHeaders
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_ConvertParagraphs(mockGUI):
|
||||
@@ -301,8 +299,6 @@ def testCoreToHtml_ConvertParagraphs(mockGUI):
|
||||
"text</b> here</p>\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToHtml_ConvertParagraphs
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_ConvertDirect(mockGUI):
|
||||
@@ -447,8 +443,6 @@ def testCoreToHtml_ConvertDirect(mockGUI):
|
||||
"<p style='margin-right: 40px;'>Some text ...</p>\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToHtml_ConvertDirect
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_SpecialCases(mockGUI):
|
||||
@@ -521,8 +515,6 @@ def testCoreToHtml_SpecialCases(mockGUI):
|
||||
"<p>Test text **<em>bold</em>** and more.</p>\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToHtml_SpecialCases
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_Save(mockGUI, fncPath):
|
||||
@@ -619,8 +611,6 @@ def testCoreToHtml_Save(mockGUI, fncPath):
|
||||
assert data["text"]["css"] == hStyle
|
||||
assert len(data["text"]["html"]) == len(resText)
|
||||
|
||||
# END Test testCoreToHtml_Save
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_Methods(mockGUI):
|
||||
@@ -668,8 +658,6 @@ def testCoreToHtml_Methods(mockGUI):
|
||||
html.setStyles(False)
|
||||
assert html.getStyleSheet() == []
|
||||
|
||||
# END Test testCoreToHtml_Methods
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToHtml_Format(mockGUI):
|
||||
@@ -726,5 +714,3 @@ def testCoreToHtml_Format(mockGUI):
|
||||
"<a class='tag' href='#char=Bod'>Bod</a>, "
|
||||
"<a class='tag' href='#char=Jane'>Jane</a>"
|
||||
)
|
||||
|
||||
# END Test testCoreToHtml_Format
|
||||
|
||||
@@ -148,8 +148,6 @@ def testCoreToken_Setters(mockGUI):
|
||||
tokens.setBlockIndent(60.0)
|
||||
assert tokens._blockIndent == 10.0
|
||||
|
||||
# END Test testCoreToken_Setters
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath):
|
||||
@@ -236,8 +234,6 @@ def testCoreToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath):
|
||||
with pytest.raises(NotImplementedError):
|
||||
tokens.doConvert()
|
||||
|
||||
# END Test testCoreToken_TextOps
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_StripEscape():
|
||||
@@ -247,8 +243,6 @@ def testCoreToken_StripEscape():
|
||||
assert stripEscape(text1) == "This is text with escapes: ** ~~ __"
|
||||
assert stripEscape(text2) == "This is text with escapes: ** ~~ __"
|
||||
|
||||
# END Test testCoreToken_StripEscape
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_HeaderFormat(mockGUI):
|
||||
@@ -438,8 +432,6 @@ def testCoreToken_HeaderFormat(mockGUI):
|
||||
]
|
||||
assert tokens.allMarkdown[-1] == "##! Prologue\n\n"
|
||||
|
||||
# END Test testCoreToken_HeaderFormat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_HeaderStyle(mockGUI):
|
||||
@@ -701,8 +693,6 @@ def testCoreToken_HeaderStyle(mockGUI):
|
||||
assert processStyle("#! My Novel\n", False) == Tokenizer.A_CENTRE | Tokenizer.A_PBB
|
||||
assert processStyle("##! Prologue\n", False) == Tokenizer.A_NONE
|
||||
|
||||
# END Test testCoreToken_HeaderStyle
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_MetaFormat(mockGUI):
|
||||
@@ -800,8 +790,6 @@ def testCoreToken_MetaFormat(mockGUI):
|
||||
(Tokenizer.T_EMPTY, 0, "", [], Tokenizer.A_NONE),
|
||||
]
|
||||
|
||||
# END Test testCoreToken_MetaFormat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_MarginFormat(mockGUI):
|
||||
@@ -854,8 +842,6 @@ def testCoreToken_MarginFormat(mockGUI):
|
||||
"Right-indent, right-aligned\n\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToken_MarginFormat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_ExtractFormats(mockGUI):
|
||||
@@ -963,8 +949,6 @@ def testCoreToken_ExtractFormats(mockGUI):
|
||||
(38, tokens.FMT_B_E, ""), (41, tokens.FMT_I_E, ""),
|
||||
]
|
||||
|
||||
# END Test testCoreToken_ExtractFormats
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_TextFormat(mockGUI):
|
||||
@@ -1084,8 +1068,6 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
"Some **nested bold and _italic_ and ~~strikethrough~~ text** here\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToken_TextFormat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_SpecialFormat(mockGUI):
|
||||
@@ -1286,8 +1268,6 @@ def testCoreToken_SpecialFormat(mockGUI):
|
||||
(Tokenizer.T_EMPTY, 1, "", [], Tokenizer.A_NONE),
|
||||
]
|
||||
|
||||
# END Test testCoreToken_SpecialFormat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_ProcessHeaders(mockGUI):
|
||||
@@ -1509,8 +1489,6 @@ def testCoreToken_ProcessHeaders(mockGUI):
|
||||
tokens.tokenizeText()
|
||||
assert tokens._noSep is False
|
||||
|
||||
# END Test testCoreToken_ProcessHeaders
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_BuildOutline(mockGUI, ipsumText):
|
||||
@@ -1576,9 +1554,6 @@ def testCoreToken_BuildOutline(mockGUI, ipsumText):
|
||||
}
|
||||
|
||||
|
||||
# END Test testCoreToken_BuildOutline
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_CountStats(mockGUI, ipsumText):
|
||||
"""Test stats counter of the Tokenizer class."""
|
||||
@@ -1784,8 +1759,6 @@ def testCoreToken_CountStats(mockGUI, ipsumText):
|
||||
"allWordChars": 3289, "textWordChars": 2990, "titleWordChars": 38
|
||||
}
|
||||
|
||||
# END Test testCoreToken_CountStats
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_SceneSeparators(mockGUI):
|
||||
@@ -1937,8 +1910,6 @@ def testCoreToken_SceneSeparators(mockGUI):
|
||||
"Text\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToken_SceneSeparators
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_HeaderVisibility(mockGUI):
|
||||
@@ -2051,8 +2022,6 @@ def testCoreToken_HeaderVisibility(mockGUI):
|
||||
"Text\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToken_HeaderVisibility
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_CounterHandling(mockGUI):
|
||||
@@ -2138,8 +2107,6 @@ def testCoreToken_CounterHandling(mockGUI):
|
||||
"Text\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToken_CounterHandling
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToken_HeadingFormatter(fncPath, mockGUI, mockRnd):
|
||||
@@ -2245,5 +2212,3 @@ def testCoreToken_HeadingFormatter(fncPath, mockGUI, mockRnd):
|
||||
# Chapter w/Fallback Focus
|
||||
cFormat = f"Chapter {nwHeadFmt.CH_NUM}, Scene {nwHeadFmt.SC_NUM} - {nwHeadFmt.CHAR_FOCUS}"
|
||||
assert formatter.apply(cFormat, "Hi Bob", 0) == "Chapter 2, Scene 3 - Focus"
|
||||
|
||||
# END Test testCoreToken_HeadingFormatter
|
||||
|
||||
@@ -71,8 +71,6 @@ def testCoreToMarkdown_ConvertHeaders(mockGUI):
|
||||
toMD.doConvert()
|
||||
assert toMD.result == "## Prologue\n\n"
|
||||
|
||||
# END Test testCoreToMarkdown_ConvertHeaders
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToMarkdown_ConvertParagraphs(mockGUI):
|
||||
@@ -209,8 +207,6 @@ def testCoreToMarkdown_ConvertParagraphs(mockGUI):
|
||||
"1. Footnote text A.\n\n"
|
||||
)
|
||||
|
||||
# END Test testCoreToMarkdown_ConvertParagraphs
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToMarkdown_ConvertDirect(mockGUI):
|
||||
@@ -250,8 +246,6 @@ def testCoreToMarkdown_ConvertDirect(mockGUI):
|
||||
toMD.doConvert()
|
||||
assert toMD.result == "\n\n"
|
||||
|
||||
# END Test testCoreToMarkdown_ConvertDirect
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToMarkdown_Save(mockGUI, fncPath):
|
||||
@@ -304,8 +298,6 @@ def testCoreToMarkdown_Save(mockGUI, fncPath):
|
||||
toMD.saveMarkdown(saveFile)
|
||||
assert saveFile.read_text(encoding="utf-8") == "".join(resText)
|
||||
|
||||
# END Test testCoreToMarkdown_Save
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToMarkdown_Format(mockGUI):
|
||||
@@ -317,5 +309,3 @@ def testCoreToMarkdown_Format(mockGUI):
|
||||
assert toMD._formatKeywords("tag: Jane", toMD.A_NONE) == "**Tag:** Jane\n\n"
|
||||
assert toMD._formatKeywords("tag: Jane, John", toMD.A_NONE) == "**Tag:** Jane, John\n\n"
|
||||
assert toMD._formatKeywords("tag: Jane", toMD.A_Z_BTMMRG) == "**Tag:** Jane \n"
|
||||
|
||||
# END Test testCoreToMarkdown_Format
|
||||
|
||||
@@ -105,9 +105,6 @@ def testCoreToOdt_Init(mockGUI):
|
||||
assert odt._xText.tag == _mkTag("office", "text")
|
||||
|
||||
|
||||
# END Test testCoreToOdt_Init
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_TextFormatting(mockGUI):
|
||||
"""Test formatting of paragraphs."""
|
||||
@@ -236,8 +233,6 @@ def testCoreToOdt_TextFormatting(mockGUI):
|
||||
'</office:text>'
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_TextFormatting
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_ConvertHeaders(mockGUI):
|
||||
@@ -325,8 +320,6 @@ def testCoreToOdt_ConvertHeaders(mockGUI):
|
||||
'</office:text>'
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_ConvertHeaders
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_ConvertParagraphs(mockGUI):
|
||||
@@ -675,8 +668,6 @@ def testCoreToOdt_ConvertParagraphs(mockGUI):
|
||||
'</office:text>'
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_ConvertParagraphs
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_ConvertDirect(mockGUI):
|
||||
@@ -730,8 +721,6 @@ def testCoreToOdt_ConvertDirect(mockGUI):
|
||||
'</office:text>'
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_ConvertDirect
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_SaveFlat(mockGUI, fncPath, tstPaths):
|
||||
@@ -787,8 +776,6 @@ def testCoreToOdt_SaveFlat(mockGUI, fncPath, tstPaths):
|
||||
copyfile(flatFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=ODT_IGNORE)
|
||||
|
||||
# END Test testCoreToOdt_SaveFlat
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths):
|
||||
@@ -867,8 +854,6 @@ def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths):
|
||||
assert cmpFiles(metaFile, metaComp, ignoreStart=ODT_IGNORE)
|
||||
assert cmpFiles(stylFile, stylComp)
|
||||
|
||||
# END Test testCoreToOdt_SaveFull
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_Format(mockGUI):
|
||||
@@ -900,8 +885,6 @@ def testCoreToOdt_Format(mockGUI):
|
||||
"Characters: Bod, Jane", [(0, ToOdt.FMT_B_B, ""), (11, ToOdt.FMT_B_E, "")]
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_Format
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_ODTParagraphStyle():
|
||||
@@ -1123,8 +1106,6 @@ def testCoreToOdt_ODTParagraphStyle():
|
||||
assert aStyle.checkNew(oStyle) is True
|
||||
assert aStyle.getID() != oStyle.getID()
|
||||
|
||||
# END Test testCoreToOdt_ODTParagraphStyle
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_ODTTextStyle():
|
||||
@@ -1248,8 +1229,6 @@ def testCoreToOdt_ODTTextStyle():
|
||||
'</style:style></test>'
|
||||
)
|
||||
|
||||
# END Test testCoreToOdt_ODTTextStyle
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_XMLParagraph():
|
||||
@@ -1439,8 +1418,6 @@ def testCoreToOdt_XMLParagraph():
|
||||
|
||||
assert xmlPar.checkError() == (1, "1 char(s) were not written: 'AB'")
|
||||
|
||||
# END Test testCoreToOdt_XMLParagraph
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreToOdt_MkTag():
|
||||
@@ -1448,5 +1425,3 @@ def testCoreToOdt_MkTag():
|
||||
assert _mkTag("office", "text") == "{urn:oasis:names:tc:opendocument:xmlns:office:1.0}text"
|
||||
assert _mkTag("style", "text") == "{urn:oasis:names:tc:opendocument:xmlns:style:1.0}text"
|
||||
assert _mkTag("blabla", "text") == "text"
|
||||
|
||||
# END Test testCoreToOdt_MkTag
|
||||
|
||||
@@ -20,20 +20,21 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import random
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from tools import C, buildTestProject
|
||||
from mocked import causeOSError
|
||||
import pytest
|
||||
|
||||
from novelwriter.enum import nwItemClass, nwItemType, nwItemLayout
|
||||
from novelwriter.common import isHandle
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.tree import NWTree
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.tree import NWTree
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@@ -263,8 +264,6 @@ def testCoreTree_BuildTree(mockGUI, mockItems):
|
||||
assert "a000000000003" not in tree
|
||||
assert tree.trashRoot is None
|
||||
|
||||
# END Test testCoreTree_BuildTree
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_PackUnpack(mockGUI, mockItems):
|
||||
@@ -292,8 +291,6 @@ def testCoreTree_PackUnpack(mockGUI, mockItems):
|
||||
tree.unpack(packed)
|
||||
assert tree.handles() == aHandles
|
||||
|
||||
# END Test testCoreTree_PackUnpack
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_CheckConsistency(caplog: pytest.LogCaptureFixture, mockGUI, fncPath, mockRnd):
|
||||
@@ -361,8 +358,6 @@ def testCoreTree_CheckConsistency(caplog: pytest.LogCaptureFixture, mockGUI, fnc
|
||||
nHandle = project.tree.findRoot(nwItemClass.NOVEL)
|
||||
assert project.tree[nHandle].itemName == "Recovered" # type: ignore
|
||||
|
||||
# END Test testCoreTree_CheckConsistency
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_Methods(monkeypatch, mockGUI, mockItems):
|
||||
@@ -442,8 +437,6 @@ def testCoreTree_Methods(monkeypatch, mockGUI, mockItems):
|
||||
"c000000000001", "b000000000001", "a000000000001"
|
||||
]
|
||||
|
||||
# END Test testCoreTree_Methods
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_MakeHandles(mockGUI):
|
||||
@@ -471,8 +464,6 @@ def testCoreTree_MakeHandles(mockGUI):
|
||||
tHandle = tree._makeHandle()
|
||||
assert tHandle == handles[3]
|
||||
|
||||
# END Test testCoreTree_MakeHandles
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_Stats(mockGUI, mockItems):
|
||||
@@ -491,8 +482,6 @@ def testCoreTree_Stats(mockGUI, mockItems):
|
||||
assert novelWords == 550
|
||||
assert noteWords == 400
|
||||
|
||||
# END Test testCoreTree_Stats
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_Reorder(caplog, mockGUI, mockItems):
|
||||
@@ -526,8 +515,6 @@ def testCoreTree_Reorder(caplog, mockGUI, mockItems):
|
||||
assert tree.handles() == bHandle
|
||||
assert "Handle 'stuff' in old tree order is not in new order" in caplog.text
|
||||
|
||||
# END Test testCoreTree_Reorder
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTree_ToCFile(monkeypatch, fncPath, mockGUI, mockItems):
|
||||
@@ -582,5 +569,3 @@ def testCoreTree_ToCFile(monkeypatch, fncPath, mockGUI, mockItems):
|
||||
f"{pathB} NOVEL DOCUMENT Scene One\n"
|
||||
f"{pathC} CHARACTER NOTE Jane Doe\n"
|
||||
)
|
||||
|
||||
# END Test testCoreTree_ToCFile
|
||||
|
||||
Reference in New Issue
Block a user