Update tests and word counter

This commit is contained in:
Veronica Berglyd Olsen
2023-11-06 11:49:26 +01:00
parent 5e41dd9a92
commit b03603cc9b
8 changed files with 81 additions and 53 deletions
+26 -1
View File
@@ -1281,7 +1281,7 @@ def testCoreIndex_CountWords():
assert wC == 9
assert pC == 4
# Formatting Codes
# Formatting Codes, Upper Case (Old Implementation)
cC, wC, pC = countWords((
"Some text\n\n"
"[NEWPAGE]\n\n"
@@ -1297,4 +1297,29 @@ def testCoreIndex_CountWords():
assert wC == 13
assert pC == 5
# Formatting Codes, Lower Case (Current Implementation)
cC, wC, pC = countWords((
"Some text\n\n"
"[newpage]\n\n"
"more text\n\n"
"[new page]]\n\n"
"even more text\n\n"
"[vspace]\n\n"
"and some final text\n\n"
"[vspace:4]\n\n"
"THE END\n\n"
))
assert cC == 58
assert wC == 13
assert pC == 5
# Check ShortCodes
cC, wC, pC = countWords((
"Text with [b]bold[/b] text and padded [b] bold [/b] text.\n\n"
"Text with [b][i] nested [/i] emphasis [/b] in it.\n\n"
))
assert cC == 78
assert wC == 14
assert pC == 2
# END Test testCoreIndex_CountWords
+13 -13
View File
@@ -789,7 +789,7 @@ def testCoreToken_SpecialFormat(mockGUI):
tokens._isFirst = True
tokens._text = (
"# Title One\n\n"
"[NEWPAGE]\n\n"
"[newpage]\n\n"
"# Title Two\n\n"
)
tokens.tokenizeText()
@@ -799,7 +799,7 @@ def testCoreToken_SpecialFormat(mockGUI):
tokens._isFirst = True
tokens._text = (
"# Title One\n\n"
"[NEW PAGE]\n\n"
"[new page]\n\n"
"# Title Two\n\n"
)
tokens.tokenizeText()
@@ -809,7 +809,7 @@ def testCoreToken_SpecialFormat(mockGUI):
tokens._isFirst = True
tokens._text = (
"# Title One\n\n"
"[NEW PAGE] \t\n\n"
"[new page] \t\n\n"
"# Title Two\n\n"
)
tokens.tokenizeText()
@@ -820,7 +820,7 @@ def testCoreToken_SpecialFormat(mockGUI):
tokens._text = (
"# Title One\n\n"
"[VSPACE] \n\n"
"[vspace] \n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -840,7 +840,7 @@ def testCoreToken_SpecialFormat(mockGUI):
# One Skip
tokens._text = (
"# Title One\n\n"
"[VSPACE:1] \n\n"
"[vspace:1] \n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -857,7 +857,7 @@ def testCoreToken_SpecialFormat(mockGUI):
# Three Skips
tokens._text = (
"# Title One\n\n"
"[VSPACE:3] \n\n"
"[vspace:3] \n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -876,7 +876,7 @@ def testCoreToken_SpecialFormat(mockGUI):
# Malformed Command, Case 1
tokens._text = (
"# Title One\n\n"
"[VSPACE:3xa] \n\n"
"[vspace:3xa] \n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -892,7 +892,7 @@ def testCoreToken_SpecialFormat(mockGUI):
# Malformed Command, Case 2
tokens._text = (
"# Title One\n\n"
"[VSPACE:3.5]\n\n"
"[vspace:3.5]\n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -908,7 +908,7 @@ def testCoreToken_SpecialFormat(mockGUI):
# Malformed Command, Case 3
tokens._text = (
"# Title One\n\n"
"[VSPACE:-1]\n\n"
"[vspace:-1]\n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -927,8 +927,8 @@ def testCoreToken_SpecialFormat(mockGUI):
# Single Skip
tokens._text = (
"# Title One\n\n"
"[NEW PAGE]\n\n"
"[VSPACE]\n\n"
"[new page]\n\n"
"[vspace]\n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()
@@ -946,8 +946,8 @@ def testCoreToken_SpecialFormat(mockGUI):
# Multiple Skip
tokens._text = (
"# Title One\n\n"
"[NEW PAGE]\n\n"
"[VSPACE:3]\n\n"
"[new page]\n\n"
"[vspace:3]\n\n"
"Some text to go here ...\n\n"
)
tokens.tokenizeText()