Fix other tests

This commit is contained in:
Veronica Berglyd Olsen
2022-04-16 15:01:55 +02:00
parent cf7e1da96a
commit fedb064b1f
21 changed files with 412 additions and 337 deletions
+24 -3
View File
@@ -31,9 +31,9 @@ from novelwriter.guimain import GuiMain
from novelwriter.common import (
checkString, checkInt, checkFloat, checkBool, checkHandle, isHandle,
isTitleTag, isItemClass, isItemType, isItemLayout, hexToInt, checkIntRange,
checkIntTuple, formatInt, formatTimeStamp, formatTime, splitVersionNumber,
transferCase, fuzzyTime, numberToRoman, jsonEncode, readTextFile,
makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser
minmax, checkIntTuple, formatInt, formatTimeStamp, formatTime, simplified,
splitVersionNumber, transferCase, fuzzyTime, numberToRoman, jsonEncode,
readTextFile, makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser
)
@@ -226,6 +226,16 @@ def testBaseCommon_CheckIntRange():
# END Test testBaseCommon_CheckIntRange
@pytest.mark.base
def testBaseCommon_MinMax():
"""Test the minmax function.
"""
for i in range(-5, 15):
assert 0 <= minmax(i, 0, 10) <= 10
# END Test testBaseCommon_MinMax
@pytest.mark.base
def testBaseCommon_CheckIntTuple():
"""Test the checkIntTuple function.
@@ -270,6 +280,17 @@ def testBaseCommon_FormatTime():
# END Test testBaseCommon_FormatTime
@pytest.mark.base
def testBaseCommon_Simplified():
"""Test the simplified function.
"""
assert simplified("Hello World") == "Hello World"
assert simplified(" Hello World ") == "Hello World"
assert simplified("\tHello\n\r\tWorld") == "Hello World"
# END Test testBaseCommon_Simplified
@pytest.mark.base
def testBaseCommon_SplitVersionNumber():
"""Test the splitVersionNumber function.