Remove encoding line and add spaces between classes and functions, tests

This commit is contained in:
Veronica Berglyd Olsen
2021-06-25 21:04:48 +02:00
parent edfd7c9770
commit 991a61f2f6
41 changed files with 150 additions and 41 deletions
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWDoc Class Tester
================================
@@ -28,6 +27,7 @@ from mock import causeOSError
from nw.core import NWProject, NWDoc
from nw.enum import nwItemClass, nwItemLayout
@pytest.mark.core
def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal):
"""Test loading and saving a document with the NWDoc class.
@@ -120,6 +120,7 @@ def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal):
# END Test testCoreDocument_Load
@pytest.mark.core
def testCoreDocument_Methods(monkeypatch, dummyGUI, nwMinimal):
"""Test other methods of the NWDoc class.
+10 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWIndex Class Tester
==================================
@@ -33,6 +32,7 @@ from nw.core.project import NWProject
from nw.core.index import NWIndex, countWords
from nw.enum import nwItemClass, nwItemLayout
@pytest.mark.core
def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir):
"""Test core functionality of scaning, saving, loading and checking
@@ -124,6 +124,7 @@ def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir):
# END Test testCoreIndex_LoadSave
@pytest.mark.core
def testCoreIndex_ScanThis(nwMinimal, dummyGUI):
"""Test the tag scanner function scanThis.
@@ -175,6 +176,7 @@ def testCoreIndex_ScanThis(nwMinimal, dummyGUI):
# END Test testCoreIndex_ScanThis
@pytest.mark.core
def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
"""Test the tag checker function checkThese.
@@ -236,6 +238,7 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
# END Test testCoreIndex_CheckThese
@pytest.mark.core
def testCoreIndex_ScanText(nwMinimal, dummyGUI):
"""Check the index text scanner.
@@ -441,6 +444,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI):
# END Test testCoreIndex_ScanText
@pytest.mark.core
def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
"""Check the index data extraction functions.
@@ -673,6 +677,7 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
# END Test testCoreIndex_ExtractData
@pytest.mark.core
def testCoreIndex_CheckTagIndex(dummyGUI):
"""Test the tag index checker.
@@ -737,6 +742,7 @@ def testCoreIndex_CheckTagIndex(dummyGUI):
# END Test testCoreIndex_CheckTagIndex
@pytest.mark.core
def testCoreIndex_CheckRefIndex(dummyGUI):
"""Test the reference index checker.
@@ -859,6 +865,7 @@ def testCoreIndex_CheckRefIndex(dummyGUI):
# END Test testCoreIndex_CheckRefIndex
@pytest.mark.core
def testCoreIndex_CheckNovelNoteIndex(dummyGUI):
"""Test the novel and note index checkers.
@@ -1117,6 +1124,7 @@ def testCoreIndex_CheckNovelNoteIndex(dummyGUI):
# END Test testCoreIndex_CheckNovelNoteIndex
@pytest.mark.core
def testCoreIndex_CheckTextCounts(dummyGUI):
"""Test the text counts checker.
@@ -1173,6 +1181,7 @@ def testCoreIndex_CheckTextCounts(dummyGUI):
# END Test testCoreIndex_CheckTextCounts
@pytest.mark.core
def testCoreIndex_CountWords():
"""Test the word counter and the exclusion filers.
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWItem Class Tester
=================================
@@ -28,6 +27,7 @@ from nw.core import NWProject
from nw.core.item import NWItem
from nw.enum import nwItemClass, nwItemType, nwItemLayout
@pytest.mark.core
def testCoreItem_Setters(dummyGUI):
"""Test all the simple setters for the NWItem class.
@@ -165,6 +165,7 @@ def testCoreItem_Setters(dummyGUI):
# END Test testCoreItem_Setters
@pytest.mark.core
def testCoreItem_TypeSetter(dummyGUI):
"""Test the setter for all the nwItemType values for the NWItem
@@ -193,6 +194,7 @@ def testCoreItem_TypeSetter(dummyGUI):
# END Test testCoreItem_TypeSetter
@pytest.mark.core
def testCoreItem_ClassSetter(dummyGUI):
"""Test the setter for all the nwItemClass values for the NWItem
@@ -233,6 +235,7 @@ def testCoreItem_ClassSetter(dummyGUI):
# END Test testCoreItem_ClassSetter
@pytest.mark.core
def testCoreItem_LayoutSetter(dummyGUI):
"""Test the setter for all the nwItemLayout values for the NWItem
@@ -269,6 +272,7 @@ def testCoreItem_LayoutSetter(dummyGUI):
# END Test testCoreItem_LayoutSetter
@pytest.mark.core
def testCoreItem_XMLPackUnpack(dummyGUI, caplog):
"""Test packing and unpacking XML objects for the NWItem class.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter OptionState Class Tester
======================================
@@ -30,6 +29,7 @@ from nw.core import NWProject
from nw.core.options import OptionState
from nw.constants import nwFiles
@pytest.mark.core
def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir):
"""Test loading and saving from the OptionState class.
@@ -100,6 +100,7 @@ def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir):
# END Test testCoreOptions_LoadSave
@pytest.mark.core
def testCoreOptions_SetGet(monkeypatch, dummyGUI, tmpDir):
"""Test setting and getting values from the OptionState class.
+17 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWProject Class Tester
====================================
@@ -35,6 +34,7 @@ from nw.enum import nwItemClass, nwItemType, nwItemLayout
from nw.common import formatTimeStamp
from nw.constants import nwFiles
@pytest.mark.core
def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI):
"""Create a new project from a project wizard dictionary. With
@@ -83,6 +83,7 @@ def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI):
# END Test testCoreProject_NewMinimal
@pytest.mark.core
def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI):
"""Create a new project from a project wizard dictionary.
@@ -124,6 +125,7 @@ def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewCustomA
@pytest.mark.core
def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI):
"""Create a new project from a project wizard dictionary.
@@ -165,6 +167,7 @@ def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewCustomB
@pytest.mark.core
def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir):
"""Check that we can create a new project can be created from the
@@ -213,6 +216,7 @@ def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir):
# END Test testCoreProject_NewSampleA
@pytest.mark.core
def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir):
"""Check that we can create a new project can be created from the
@@ -250,6 +254,7 @@ def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir):
# END Test testCoreProject_NewSampleB
@pytest.mark.core
def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI):
"""Check that new root folders can be added to the project.
@@ -286,6 +291,7 @@ def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewRoot
@pytest.mark.core
def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI):
"""Check that new files can be added to the project.
@@ -315,6 +321,7 @@ def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewFile
@pytest.mark.core
def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI):
"""Test opening a project.
@@ -436,6 +443,7 @@ def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI):
# END Test testCoreProject_Open
@pytest.mark.core
def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir):
"""Test saving a project.
@@ -481,6 +489,7 @@ def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir):
# END Test testCoreProject_Save
@pytest.mark.core
def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI):
"""Test lock file functions for the project folder.
@@ -540,6 +549,7 @@ def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI):
# END Test testCoreProject_LockFile
@pytest.mark.core
def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI):
"""Test helper functions for the project folder.
@@ -583,6 +593,7 @@ def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI):
# END Test testCoreProject_Helpers
@pytest.mark.core
def testCoreProject_AccessItems(nwMinimal, dummyGUI):
"""Test helper functions for the project folder.
@@ -642,6 +653,7 @@ def testCoreProject_AccessItems(nwMinimal, dummyGUI):
# END Test testCoreProject_AccessItems
@pytest.mark.core
def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir):
"""Test other project class methods and functions.
@@ -892,6 +904,7 @@ def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir):
# END Test testCoreProject_Methods
@pytest.mark.core
def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum):
"""Check that files in the content folder that are not tracked in
@@ -968,6 +981,7 @@ def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum):
# END Test testCoreProject_OrphanedFiles
@pytest.mark.core
def testCoreProject_OldFormat(dummyGUI, nwOldProj):
"""Test that a project folder structure of version 1.0 can be
@@ -1057,6 +1071,7 @@ def testCoreProject_OldFormat(dummyGUI, nwOldProj):
# END Test testCoreProject_OldFormat
@pytest.mark.core
def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir):
"""Test the functins that handle legacy data folders and structure
@@ -1162,6 +1177,7 @@ def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir):
# END Test testCoreProject_LegacyData
@pytest.mark.core
def testCoreProject_Backup(monkeypatch, dummyGUI, nwMinimal, tmpDir):
"""Test the automated backup feature of the project class. The test
+3 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter Spell Check Classes Tester
========================================
@@ -29,6 +28,7 @@ from tools import readFile, writeFile
from nw.core.spellcheck import NWSpellCheck, NWSpellEnchant, NWSpellSimple
@pytest.mark.core
def testCoreSpell_Super(monkeypatch, tmpDir):
"""Test the spell checker super class
@@ -70,6 +70,7 @@ def testCoreSpell_Super(monkeypatch, tmpDir):
# END Test testCoreSpell_Super
@pytest.mark.core
def testCoreSpell_Enchant(monkeypatch, tmpDir):
"""Test the pyenchant spell checker
@@ -114,6 +115,7 @@ def testCoreSpell_Enchant(monkeypatch, tmpDir):
# END Test testCoreSpell_Enchant
@pytest.mark.core
def testCoreSpell_Simple(monkeypatch, tmpDir):
"""Test the fallback simple spell checker
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWStatus Class Tester
===================================
@@ -26,6 +25,7 @@ from lxml import etree
from nw.core.status import NWStatus
@pytest.mark.core
def testCoreStatus_Entries():
"""Test all the simple setters for the NWItem class.
@@ -100,6 +100,7 @@ def testCoreStatus_Entries():
# END Test testCoreStatus_Entries
@pytest.mark.core
def testCoreStatus_XMLPackUnpack():
"""Test all the simple setters for the NWItem class.
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter ToHtml Class Tester
=================================
@@ -27,6 +26,7 @@ from tools import readFile
from nw.core import NWProject, NWIndex, ToHtml
@pytest.mark.core
def testCoreToHtml_Format(dummyGUI):
"""Test all the formatters for the ToHtml class.
@@ -79,6 +79,7 @@ def testCoreToHtml_Format(dummyGUI):
# END Test testCoreToHtml_Format
@pytest.mark.core
def testCoreToHtml_Convert(dummyGUI):
"""Test the converter of the ToHtml class.
@@ -344,6 +345,8 @@ def testCoreToHtml_Convert(dummyGUI):
# END Test testCoreToHtml_Convert
@pytest.mark.core
def testCoreToHtml_Complex(dummyGUI, fncDir):
"""Test the ave method of the ToHtml class.
"""
@@ -416,6 +419,7 @@ def testCoreToHtml_Complex(dummyGUI, fncDir):
# END Test testCoreToHtml_Save
@pytest.mark.core
def testCoreToHtml_Methods(dummyGUI):
"""Test all the other methods of the ToHtml class.
+4 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter Tokenizer Class Tester
====================================
@@ -28,6 +27,7 @@ from tools import readFile
from nw.core import NWProject, NWDoc
from nw.core.tokenizer import Tokenizer
@pytest.mark.core
def testCoreToken_Setters(dummyGUI):
"""Test all the setters for the Tokenizer class.
@@ -111,6 +111,7 @@ def testCoreToken_Setters(dummyGUI):
# END Test testCoreToken_Setters
@pytest.mark.core
def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI):
"""Test handling files and text in the Tokenizer class.
@@ -193,6 +194,7 @@ def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI):
# END Test testCoreToken_TextOps
@pytest.mark.core
def testCoreToken_Tokenize(dummyGUI):
"""Test the tokenization of the Tokenizer class.
@@ -494,6 +496,7 @@ def testCoreToken_Tokenize(dummyGUI):
# END Test testCoreToken_Tokenize
@pytest.mark.core
def testCoreToken_Headers(dummyGUI):
"""Test the header and page parser of the Tokenizer class.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter ToOdt Class Tester
=================================
@@ -35,6 +34,7 @@ XML_NS = [
' xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"',
]
def xmlToText(xElem):
"""Get the text content of an XML element.
"""
@@ -43,6 +43,7 @@ def xmlToText(xElem):
rTxt = rTxt.replace(nSpace, "")
return rTxt
@pytest.mark.core
def testCoreToOdt_Convert(dummyGUI):
"""Test the converter of the ToHtml class.
+9 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
novelWriter NWTree Class Tester
=================================
@@ -30,6 +29,7 @@ from nw.core.project import NWProject, NWItem, NWTree
from nw.enum import nwItemClass, nwItemType, nwItemLayout
from nw.constants import nwFiles
@pytest.fixture(scope="function")
def dummyItems(dummyGUI):
"""Create a list of mock items.
@@ -106,6 +106,7 @@ def dummyItems(dummyGUI):
return theItems
@pytest.mark.core
def testCoreTree_BuildTree(dummyGUI, dummyItems):
"""Test building a project tree from a list of items.
@@ -202,6 +203,7 @@ def testCoreTree_BuildTree(dummyGUI, dummyItems):
# END Test testCoreTree_BuildTree
@pytest.mark.core
def testCoreTree_Methods(dummyGUI, dummyItems):
"""Test bvarious class methods.
@@ -258,6 +260,7 @@ def testCoreTree_Methods(dummyGUI, dummyItems):
# END Test testCoreTree_Methods
@pytest.mark.core
def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems):
"""Test building a project tree from a list of items.
@@ -383,6 +386,7 @@ def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems):
# END Test testCoreTree_UpdateItemLayout
@pytest.mark.core
def testCoreTree_MakeHandles(monkeypatch, dummyGUI):
"""Test generating item handles.
@@ -425,6 +429,7 @@ def testCoreTree_MakeHandles(monkeypatch, dummyGUI):
# END Test testCoreTree_MakeHandles
@pytest.mark.core
def testCoreTree_Stats(dummyGUI, dummyItems):
"""Test project stats methods.
@@ -451,6 +456,7 @@ def testCoreTree_Stats(dummyGUI, dummyItems):
# END Test testCoreTree_Stats
@pytest.mark.core
def testCoreTree_Reorder(dummyGUI, dummyItems):
"""Test changing tree order.
@@ -482,6 +488,7 @@ def testCoreTree_Reorder(dummyGUI, dummyItems):
# END Test testCoreTree_Reorder
@pytest.mark.core
def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems):
"""Test packing and unpacking the tree to and from XML.
@@ -537,6 +544,7 @@ def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems):
# END Test testCoreTree_XMLPackUnpack
@pytest.mark.core
def testCoreTree_ToCFile(monkeypatch, dummyGUI, dummyItems, tmpDir):
"""Test writing the ToC.txt file.