diff --git a/nw/core/project.py b/nw/core/project.py index cf8dd32f..953d7879 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -981,7 +981,7 @@ class NWProject(): def setProjBackup(self, doBackup): """Set whether projects should be backed up or not. The user - will notified in case dependant settings are missing. + will be notified in case required settings are missing. """ self.doBackup = doBackup if doBackup: diff --git a/nw/core/tools.py b/nw/core/tools.py index c5ef9eed..ce30de96 100644 --- a/nw/core/tools.py +++ b/nw/core/tools.py @@ -121,7 +121,6 @@ def numberToWord(numVal, theLanguage): numWord = _numberToWordEN(numVal) else: numWord = _numberToWordEN(numVal) - # print("%4d : %s" % (numVal, numWord)) return numWord def _numberToWordEN(numVal): diff --git a/tests/test_project.py b/tests/test_project.py index 14edf1fe..21423ffe 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -304,7 +304,7 @@ def testProjectMethods(monkeypatch, nwMinimal, nwDummy): projPath = os.path.join(nwMinimal, "dummy1") assert theProject.setProjectPath(projPath, newProject=True) - # Make the os.mkdir fail + # Make os.mkdir fail def altMkdir(*args): raise Exception("Oops!") @@ -312,6 +312,19 @@ def testProjectMethods(monkeypatch, nwMinimal, nwDummy): projPath = os.path.join(nwMinimal, "dummy2") assert not theProject.setProjectPath(projPath, newProject=True) + # Project Name + assert theProject.setProjectName(" A Name ") + assert theProject.projName == "A Name" + + # Project Title + assert theProject.setBookTitle(" A Title ") + assert theProject.bookTitle == "A Title" + + # Project Authors + assert not theProject.setBookAuthors([]) + assert theProject.setBookAuthors(" Jane Doe \n John Doh \n ") + assert theProject.bookAuthors == ["Jane Doe", "John Doh"] + @pytest.mark.project def testDocMeta(nwDummy, nwLipsum): """Check that the document meta data string is parsed correctly. diff --git a/tests/test_tools.py b/tests/test_tools.py index bd79fb69..bfff8f3f 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -8,6 +8,8 @@ from nw.core.tools import countWords, numberToRoman, numberToWord @pytest.mark.core def testCountWords(): + """Test the word counter and the exclusion filers. + """ testText = ( "# Heading One\n" "## Heading Two\n" @@ -33,6 +35,8 @@ def testCountWords(): @pytest.mark.core def testNumberWords(): + """Test the conversion of integer to English words. + """ assert numberToWord(0, "en") == "Zero" assert numberToWord(1, "en") == "One" assert numberToWord(2, "en") == "Two" @@ -60,8 +64,15 @@ def testNumberWords(): assert numberToWord(142, "en") == "One Hundred Forty-Two" assert numberToWord(999, "en") == "Nine Hundred Ninety-Nine" + # Check a few with a nonsense language setting + assert numberToWord(1, "foo") == "One" + assert numberToWord(2, "foo") == "Two" + assert numberToWord(3, "foo") == "Three" + @pytest.mark.core def testRomanNumbers(): + """Test conversion of integers to Roman numbers. + """ assert numberToRoman(None, False) == "NAN" assert numberToRoman(0, False) == "OOR" assert numberToRoman(1, False) == "I"