Merge branch 'main' into feature/status_shapes
This commit is contained in:
@@ -200,6 +200,9 @@ def testBaseConfig_Methods(fncPath):
|
||||
tstConf = Config()
|
||||
tstConf.initConfig(confPath=fncPath, dataPath=fncPath)
|
||||
|
||||
# Home Path
|
||||
assert tstConf.homePath() == Path.home().absolute()
|
||||
|
||||
# Data Path
|
||||
assert tstConf.dataPath() == fncPath
|
||||
assert tstConf.dataPath("stuff") == fncPath / "stuff"
|
||||
|
||||
@@ -27,6 +27,7 @@ import shutil
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from tools import C, buildTestProject
|
||||
from mocked import causeOSError
|
||||
|
||||
@@ -58,7 +59,7 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
|
||||
build.setName("Test Build")
|
||||
assert build.name == "Test Build"
|
||||
|
||||
# Only valid UUIDs are accpeted, anything else generates a new UUID
|
||||
# Only valid UUIDs are accepted, anything else generates a new UUID
|
||||
build.setBuildID("5cf45d24-f496-42c9-8733-529a9e52a62b")
|
||||
assert build.buildID == "5cf45d24-f496-42c9-8733-529a9e52a62b"
|
||||
|
||||
@@ -72,14 +73,14 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
|
||||
|
||||
# Last path must be valid, if not it defaults to $HOME
|
||||
build.setLastPath("/path/to/nowhere")
|
||||
assert build.lastPath == Path.home()
|
||||
assert build.lastPath == CONFIG.homePath()
|
||||
|
||||
build.setLastPath(None)
|
||||
assert build.lastPath == Path.home()
|
||||
assert build.lastPath == CONFIG.homePath()
|
||||
|
||||
(fncPath / "test.txt").write_text("foobar")
|
||||
build.setLastPath(fncPath / "test.txt") # Can't be a file
|
||||
assert build.lastPath == Path.home()
|
||||
assert build.lastPath == CONFIG.homePath()
|
||||
|
||||
build.setLastPath(fncPath)
|
||||
assert build.lastPath == fncPath
|
||||
@@ -93,7 +94,7 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
|
||||
build.setLastPath(testDir)
|
||||
assert build.lastPath == testDir
|
||||
testDir.rmdir()
|
||||
assert build.lastPath == Path.home()
|
||||
assert build.lastPath == CONFIG.homePath()
|
||||
|
||||
# Last build name
|
||||
build.setLastBuildName(None) # type: ignore
|
||||
|
||||
@@ -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"
|
||||
@@ -88,7 +92,8 @@ def testTextCounting_standardCounter():
|
||||
"# Heading One\n"
|
||||
"## Heading Two\n"
|
||||
"### Heading Three\n"
|
||||
"#### Heading Four\n\n"
|
||||
"###! Heading Four\n"
|
||||
"#### Heading Five\n\n"
|
||||
"@tag: value\n\n"
|
||||
"% A comment that should not be counted.\n\n"
|
||||
"The first paragraph.\n\n"
|
||||
@@ -96,8 +101,8 @@ def testTextCounting_standardCounter():
|
||||
"The third paragraph.\n\n"
|
||||
"Dashes\u2013and even longer\u2014dashes."
|
||||
))
|
||||
assert cC == 151
|
||||
assert wC == 24
|
||||
assert cC == 163
|
||||
assert wC == 26
|
||||
assert pC == 4
|
||||
|
||||
# Text Alignment
|
||||
@@ -182,7 +187,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((
|
||||
|
||||
Reference in New Issue
Block a user