Remove all END Test comments

This commit is contained in:
Veronica Berglyd Olsen
2024-05-10 16:06:23 +02:00
parent 142d7c4f3a
commit 3f4538a60e
55 changed files with 148 additions and 671 deletions
-70
View File
@@ -54,8 +54,6 @@ def testBaseCommon_checkStringNone():
assert checkStringNone(1.0, "NotNone") == "NotNone"
assert checkStringNone(True, "NotNone") == "NotNone"
# END Test testBaseCommon_checkStringNone
@pytest.mark.base
def testBaseCommon_checkString():
@@ -69,8 +67,6 @@ def testBaseCommon_checkString():
assert checkString(1.0, "default") == "default"
assert checkString(True, "default") == "default"
# END Test testBaseCommon_checkString
@pytest.mark.base
def testBaseCommon_checkInt():
@@ -85,8 +81,6 @@ def testBaseCommon_checkInt():
assert checkInt("1", 3) == 1
assert checkInt("1.0", 3) == 3
# END Test testBaseCommon_checkInt
@pytest.mark.base
def testBaseCommon_checkFloat():
@@ -101,8 +95,6 @@ def testBaseCommon_checkFloat():
assert checkFloat("1", 3.0) == 1.0
assert checkFloat("1.0", 3.0) == 1.0
# END Test testBaseCommon_checkFloat
@pytest.mark.base
def testBaseCommon_checkBool():
@@ -150,8 +142,6 @@ def testBaseCommon_checkBool():
assert checkBool(2.0, True) is True
assert checkBool(2.0, False) is False
# END Test testBaseCommon_checkBool
@pytest.mark.base
def testBaseCommon_checkUuid():
@@ -163,8 +153,6 @@ def testBaseCommon_checkUuid():
assert checkUuid("e2be99af-f9bf-4403-857a-c3d1ac25abeaa", None) is None # type: ignore
assert checkUuid(testUuid, None) == testUuid # type: ignore
# END Test testBaseCommon_checkUuid
@pytest.mark.base
def testBaseCommon_checkPath():
@@ -175,8 +163,6 @@ def testBaseCommon_checkPath():
assert checkPath("", None) is None # type: ignore
assert checkPath(" ", None) is None # type: ignore
# END Test testBaseCommon_checkPath
@pytest.mark.base
def testBaseCommon_isHandle():
@@ -188,8 +174,6 @@ def testBaseCommon_isHandle():
assert isHandle(None) is False
assert isHandle("STUFF") is False
# END Test testBaseCommon_isHandle
@pytest.mark.base
def testBaseCommon_isTitleTag():
@@ -205,8 +189,6 @@ def testBaseCommon_isTitleTag():
assert isTitleTag(None) is False
assert isTitleTag("STUFF") is False
# END Test testBaseCommon_isTitleTag
@pytest.mark.base
def testBaseCommon_isItemClass():
@@ -228,8 +210,6 @@ def testBaseCommon_isItemClass():
assert isItemClass(None) is False
assert isItemClass("STUFF") is False
# END Test testBaseCommon_isItemClass
@pytest.mark.base
def testBaseCommon_isItemType():
@@ -247,8 +227,6 @@ def testBaseCommon_isItemType():
assert isItemType(None) is False # type: ignore
assert isItemType("STUFF") is False
# END Test testBaseCommon_isItemType
@pytest.mark.base
def testBaseCommon_isItemLayout():
@@ -271,8 +249,6 @@ def testBaseCommon_isItemLayout():
assert isItemLayout(None) is False # type: ignore
assert isItemLayout("STUFF") is False
# END Test testBaseCommon_isItemLayout
@pytest.mark.base
def testBaseCommon_isListInstance():
@@ -289,8 +265,6 @@ def testBaseCommon_isListInstance():
assert isListInstance([1], str) is False
assert isListInstance(["stuff"], int) is False
# END Test testBaseCommon_isListInstance
@pytest.mark.base
def testBaseCommon_hexToInt():
@@ -302,8 +276,6 @@ def testBaseCommon_hexToInt():
assert hexToInt("0xffffq") == 0
assert hexToInt("0xffffq", 12) == 12
# END Test testBaseCommon_hexToInt
@pytest.mark.base
def testBaseCommon_minmax():
@@ -311,8 +283,6 @@ def testBaseCommon_minmax():
for i in range(-5, 15):
assert 0 <= minmax(i, 0, 10) <= 10
# END Test testBaseCommon_minmax
@pytest.mark.base
def testBaseCommon_checkIntTuple():
@@ -320,8 +290,6 @@ def testBaseCommon_checkIntTuple():
assert checkIntTuple(0, (0, 1, 2), 3) == 0
assert checkIntTuple(5, (0, 1, 2), 3) == 3
# END Test testBaseCommon_checkIntTuple
@pytest.mark.base
def testBaseCommon_formatTimeStamp():
@@ -330,8 +298,6 @@ def testBaseCommon_formatTimeStamp():
assert formatTimeStamp(tTime, False) == "1970-01-01 00:00:00"
assert formatTimeStamp(tTime, True) == "1970-01-01 00.00.00"
# END Test testBaseCommon_formatTimeStamp
@pytest.mark.base
def testBaseCommon_formatTime():
@@ -352,8 +318,6 @@ def testBaseCommon_formatTime():
assert formatTime(86400) == "1-00:00:00"
assert formatTime(360000) == "4-04:00:00"
# END Test testBaseCommon_formatTime
@pytest.mark.base
def testBaseCommon_formatVersion():
@@ -363,8 +327,6 @@ def testBaseCommon_formatVersion():
assert formatVersion("1.2b2") == "1.2 Beta 2"
assert formatVersion("1.2rc3") == "1.2 RC 3"
# END Test testBaseCommon_formatVersion
@pytest.mark.base
def testBaseCommon_formatFileFilter():
@@ -375,8 +337,6 @@ def testBaseCommon_formatFileFilter():
"Stuff (*.stuff);;Text files (*.txt);;All files (*)"
)
# END Test testBaseCommon_formatFileFilter
@pytest.mark.base
def testBaseCommon_simplified():
@@ -385,8 +345,6 @@ def testBaseCommon_simplified():
assert simplified(" Hello World ") == "Hello World"
assert simplified("\tHello\n\r\tWorld") == "Hello World"
# END Test testBaseCommon_simplified
@pytest.mark.base
def testBaseCommon_elide():
@@ -405,8 +363,6 @@ def testBaseCommon_elide():
assert elide("Hello World!", 1) == " ..."
assert elide("Hello World!", 0) == " ..."
# END Test testBaseCommon_elide
@pytest.mark.base
def testBaseCommon_yesNo():
@@ -432,8 +388,6 @@ def testBaseCommon_yesNo():
assert yesNo(1.0) == "yes" # type: ignore
assert yesNo(2.0) == "yes" # type: ignore
# END Test testBaseCommon_yesNo
@pytest.mark.base
def testBaseCommon_formatInt():
@@ -455,8 +409,6 @@ def testBaseCommon_formatInt():
assert formatInt(None) == "ERR" # type: ignore
assert formatInt("42") == "ERR" # type: ignore
# END Test testBaseCommon_formatInt
@pytest.mark.base
def testBaseCommon_transferCase():
@@ -469,8 +421,6 @@ def testBaseCommon_transferCase():
assert transferCase("SOURCE", "target") == "TARGET"
assert transferCase("source", "TARGET") == "target"
# END Test testBaseCommon_transferCase
@pytest.mark.base
def testBaseCommon_fuzzyTime():
@@ -504,8 +454,6 @@ def testBaseCommon_fuzzyTime():
assert fuzzyTime(47336399) == "a year ago"
assert fuzzyTime(47336400) == "2 years ago"
# END Test testBaseCommon_fuzzyTime
@pytest.mark.core
def testBaseCommon_numberToRoman():
@@ -531,8 +479,6 @@ def testBaseCommon_numberToRoman():
assert numberToRoman(2010, False) == "MMX"
assert numberToRoman(999, True) == "cmxcix"
# END Test testBaseCommon_numberToRoman
@pytest.mark.base
def testBaseCommon_cssCol():
@@ -540,8 +486,6 @@ def testBaseCommon_cssCol():
assert cssCol(QColor(0, 0, 0, 0)) == "rgba(0, 0, 0, 0)"
assert cssCol(QColor(10, 20, 30, 40)) == "rgba(10, 20, 30, 40)"
# END Test testBaseCommon_cssCol
@pytest.mark.base
def testBaseCommon_jsonEncode():
@@ -623,8 +567,6 @@ def testBaseCommon_jsonEncode():
'}'
)
# END Test testBaseCommon_jsonEncode
@pytest.mark.base
def testBaseCommon_xmlIndent():
@@ -650,8 +592,6 @@ def testBaseCommon_xmlIndent():
xmlIndent(data) # type: ignore
assert data == "foobar"
# END Test testBaseCommon_xmlIndent
@pytest.mark.base
def testBaseCommon_readTextFile(monkeypatch, fncPath, ipsumText):
@@ -667,8 +607,6 @@ def testBaseCommon_readTextFile(monkeypatch, fncPath, ipsumText):
mp.setattr("pathlib.Path.read_text", causeOSError)
assert readTextFile(testFile) == ""
# END Test testBaseCommon_readTextFile
@pytest.mark.base
def testBaseCommon_makeFileNameSafe():
@@ -680,8 +618,6 @@ def testBaseCommon_makeFileNameSafe():
assert makeFileNameSafe("æøå") == "æøå"
assert makeFileNameSafe("Stuff œfi2⁵") == "Stuff œfi25"
# END Test testBaseCommon_makeFileNameSafe
@pytest.mark.base
def testBaseCommon_getFileSize(fncPath):
@@ -693,8 +629,6 @@ def testBaseCommon_getFileSize(fncPath):
assert getFileSize(fncPath / "one.txt") == 6
assert getFileSize(fncPath / "two.txt") == 0
# END Test testBaseCommon_getFileSize
@pytest.mark.base
def testBaseCommon_openExternalPath(monkeypatch, tstPaths):
@@ -711,8 +645,6 @@ def testBaseCommon_openExternalPath(monkeypatch, tstPaths):
assert openExternalPath(tstPaths.tmpDir) is True
assert lastUrl.startswith("file://")
# END Test testBaseCommon_openExternalPath
@pytest.mark.base
def testBaseCommon_NWConfigParser(fncPath):
@@ -801,5 +733,3 @@ def testBaseCommon_NWConfigParser(fncPath):
assert cfgParser.rdIntList("nope", "list2", [1]) == [1]
assert cfgParser.rdIntList("main", "blabla", [1]) == [1]
# END Test testBaseCommon_NWConfigParser
+5 -18
View File
@@ -21,18 +21,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import annotations
import sys
import pytest
from shutil import copyfile
from pathlib import Path
from shutil import copyfile
from mocked import causeOSError, MockApp
from tools import cmpFiles, writeFile
import pytest
from novelwriter import CONFIG
from novelwriter.config import Config, RecentProjects
from novelwriter.constants import nwFiles
from tests.mocked import MockApp, causeOSError
from tests.tools import cmpFiles, writeFile
@pytest.mark.base
def testBaseConfig_Constructor(monkeypatch):
@@ -88,8 +89,6 @@ def testBaseConfig_Constructor(monkeypatch):
tstConf = Config()
assert tstConf._appPath == tstConf._appRoot
# END Test testBaseConfig_Constructor
@pytest.mark.base
def testBaseConfig_InitLoadSave(monkeypatch, fncPath, tstPaths):
@@ -153,8 +152,6 @@ def testBaseConfig_InitLoadSave(monkeypatch, fncPath, tstPaths):
assert newConf.doReplaceDQuote is False
assert newConf.doReplaceSQuote is False
# END Test testBaseConfig_InitLoadSave
@pytest.mark.base
def testBaseConfig_Localisation(fncPath, tstPaths):
@@ -191,8 +188,6 @@ def testBaseConfig_Localisation(fncPath, tstPaths):
languages = tstConf.listLanguages(tstConf.LANG_NW)
assert languages == [("en_GB", "British English"), ("fr", "Français")]
# END Test testBaseConfig_Localisation
@pytest.mark.base
def testBaseConfig_Methods(fncPath):
@@ -237,8 +232,6 @@ def testBaseConfig_Methods(fncPath):
# Recent Projects
assert isinstance(tstConf.recentProjects, RecentProjects)
# END Test testBaseConfig_Methods
@pytest.mark.base
def testBaseConfig_SettersGetters(fncPath):
@@ -361,8 +354,6 @@ def testBaseConfig_SettersGetters(fncPath):
assert tstConf.getTextMargin() == 80
assert tstConf.getTabWidth() == 80
# END Test testBaseConfig_SettersGetters
@pytest.mark.base
def testBaseConfig_Internal(monkeypatch, fncPath):
@@ -383,8 +374,6 @@ def testBaseConfig_Internal(monkeypatch, fncPath):
tstConf._checkOptionalPackages()
assert tstConf.hasEnchant is False
# END Test testBaseConfig_Internal
@pytest.mark.base
def testBaseConfig_RecentCache(monkeypatch, tstPaths):
@@ -446,5 +435,3 @@ def testBaseConfig_RecentCache(monkeypatch, tstPaths):
assert recent.listEntries() == [
(str(pathOne), "Proj One", 100, 1600002000),
]
# END Test testBaseConfig_RecentCache
+2 -6
View File
@@ -22,10 +22,10 @@ from __future__ import annotations
import pytest
from mocked import causeException
from novelwriter.error import NWErrorMessage, exceptionHandler
from tests.mocked import causeException
@pytest.mark.base
def testBaseError_Dialog(qtbot, monkeypatch, nwGUI):
@@ -61,8 +61,6 @@ def testBaseError_Dialog(qtbot, monkeypatch, nwGUI):
nwErr.close()
nwGUI.closeMain()
# END Test testBaseError_Dialog
@pytest.mark.base
def testBaseError_Handler(qtbot, monkeypatch, nwGUI):
@@ -98,5 +96,3 @@ def testBaseError_Handler(qtbot, monkeypatch, nwGUI):
exceptionHandler(Exception, "Error Message", None) # type: ignore
nwGUI.closeMain()
# END Test testBaseError_Handler
+5 -10
View File
@@ -20,13 +20,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
import sys
import pytest
import logging
import sys
from mocked import MockGuiMain
import pytest
from novelwriter import CONFIG, main, logger
from novelwriter import CONFIG, logger, main
from tests.mocked import MockGuiMain
@pytest.mark.base
@@ -71,8 +72,6 @@ def testBaseInit_Launch(caplog, monkeypatch, fncPath):
main([f"--config={fncPath}", f"--data={fncPath}"])
assert ex.value.code == 0
# END Test testBaseInit_Launch
@pytest.mark.base
def testBaseInit_Options(monkeypatch, fncPath):
@@ -136,8 +135,6 @@ def testBaseInit_Options(monkeypatch, fncPath):
)
assert nwGUI.closeMain() == "closeMain"
# END Test testBaseInit_Options
@pytest.mark.base
def testBaseInit_Imports(caplog, monkeypatch, fncPath):
@@ -164,5 +161,3 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath):
assert "At least Python" in caplog.messages[0]
assert "At least Qt5" in caplog.messages[1]
assert "At least PyQt5" in caplog.messages[2]
# END Test testBaseInit_Imports
+4 -10
View File
@@ -22,13 +22,13 @@ from __future__ import annotations
import pytest
from tools import buildTestProject
from mocked import MockGuiMain, MockTheme
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget
from novelwriter.shared import SharedData
from novelwriter.core.project import NWProject
from novelwriter.shared import SharedData
from tests.mocked import MockGuiMain, MockTheme
from tests.tools import buildTestProject
@pytest.mark.base
@@ -62,8 +62,6 @@ def testBaseSharedData_Init():
assert shared.projectIdleTime == 0.0
assert shared.projectLock is None
# END Test testBaseSharedData_Init
@pytest.mark.base
def testBaseSharedData_Projects(monkeypatch, caplog, fncPath):
@@ -123,8 +121,6 @@ def testBaseSharedData_Projects(monkeypatch, caplog, fncPath):
mp.setattr(QFileDialog, "getOpenFileName", lambda *a, **k: (a[2], ""))
assert shared.getProjectPath(QWidget(), fncPath, allowZip=True) == fncPath
# END Test testBaseSharedData_Projects
@pytest.mark.base
def testBaseSharedData_Alerts(qtbot, monkeypatch, caplog):
@@ -171,5 +167,3 @@ def testBaseSharedData_Alerts(qtbot, monkeypatch, caplog):
# Question box
assert shared.question("Why?") is True
assert shared.lastAlert == "Why?"
# END Test testBaseSharedData_Alerts