Fix word counter bug (#1816)

This commit is contained in:
Veronica Berglyd Olsen
2024-04-13 00:37:21 +02:00
parent 61e634a86c
commit 3e711ebe7f
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -29,7 +29,7 @@ from novelwriter.text.counting import bodyTextCounter, preProcessText, standardC
def testTextCounting_preProcessText():
"""Test the text preprocessor for counters."""
# Not Text
assert preProcessText(None) == []
assert preProcessText(None) == [] # type: ignore
# No Text
assert preProcessText("") == []
@@ -81,6 +81,10 @@ def testTextCounting_standardCounter():
assert standardCounter(None) == (0, 0, 0) # type: ignore
assert standardCounter(1234) == (0, 0, 0) # type: ignore
# Test Corner Cases, Bug #1816
assert standardCounter("> ") == (0, 0, 0)
assert standardCounter(" <") == (0, 0, 0)
# General Text
cC, wC, pC = standardCounter((
"#! Title\n\n"
@@ -182,7 +186,7 @@ def testTextCounting_standardCounter():
def testTextCounting_bodyTextCounter():
"""Test the body text counter."""
# Not Text
assert bodyTextCounter(None) == (0, 0, 0)
assert bodyTextCounter(None) == (0, 0, 0) # type: ignore
# General Text
wC, cC, sC = bodyTextCounter((