Improve type checking in common module, and delete unused function
This commit is contained in:
@@ -33,9 +33,9 @@ from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtCore import QUrl
|
||||
|
||||
from novelwriter.common import (
|
||||
checkBool, checkFloat, checkHandle, checkInt, checkIntTuple, checkPath,
|
||||
checkString, checkStringNone, checkUuid, formatInt, formatTime,
|
||||
formatTimeStamp, formatVersion, fuzzyTime, getFileSize, hexToInt, isHandle, isItemClass,
|
||||
checkBool, checkFloat, checkInt, checkIntTuple, checkPath, checkString,
|
||||
checkStringNone, checkUuid, formatInt, formatTime, formatTimeStamp,
|
||||
formatVersion, fuzzyTime, getFileSize, hexToInt, isHandle, isItemClass,
|
||||
isItemLayout, isItemType, isTitleTag, jsonEncode, makeFileNameSafe, minmax,
|
||||
numberToRoman, NWConfigParser, openExternalPath, readTextFile, simplified,
|
||||
transferCase, xmlIndent, yesNo
|
||||
@@ -151,19 +151,6 @@ def testBaseCommon_checkBool():
|
||||
# END Test testBaseCommon_checkBool
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_checkHandle():
|
||||
"""Test the checkHandle function."""
|
||||
assert checkHandle("None", 1, True) is None
|
||||
assert checkHandle("None", 1, False) == 1
|
||||
assert checkHandle(None, 1, True) is None
|
||||
assert checkHandle(None, 1, False) == 1
|
||||
assert checkHandle("47666c91c7ccf", None, False) == "47666c91c7ccf"
|
||||
assert checkHandle("h7666c91c7ccf", None, False) is None
|
||||
|
||||
# END Test testBaseCommon_checkHandle
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_checkUuid():
|
||||
"""Test the checkUuid function."""
|
||||
@@ -236,7 +223,7 @@ def testBaseCommon_isItemClass():
|
||||
|
||||
# Invalid
|
||||
assert isItemClass("None") is False
|
||||
assert isItemClass(None) is False # type: ignore
|
||||
assert isItemClass(None) is False
|
||||
assert isItemClass("STUFF") is False
|
||||
|
||||
# END Test testBaseCommon_isItemClass
|
||||
|
||||
Reference in New Issue
Block a user