Spell check comments and docstrings

This commit is contained in:
Veronica Berglyd Olsen
2023-07-20 23:25:49 +02:00
parent e773884c29
commit 4dfa51855e
45 changed files with 122 additions and 175 deletions
+12 -23
View File
@@ -39,8 +39,7 @@ KEY_DELAY = 1
@pytest.mark.gui
def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
"""Test initialising the editor.
"""
"""Test initialising the editor."""
# Open project
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc)
@@ -82,8 +81,7 @@ def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
@pytest.mark.gui
def testGuiEditor_LoadText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumText, mockRnd):
"""Test loading text into the editor.
"""
"""Test loading text into the editor."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -137,8 +135,7 @@ def testGuiEditor_LoadText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumTex
@pytest.mark.gui
def testGuiEditor_SaveText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumText, mockRnd):
"""Test saving text from the editor.
"""
"""Test saving text from the editor."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -154,7 +151,7 @@ def testGuiEditor_SaveText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumTex
assert nwGUI.docEditor.saveText() is False
nwGUI.docEditor._nwItem = nwItem
# Unkown handle
# Unknown handle
nwGUI.docEditor._docHandle = "0123456789abcdef"
assert nwGUI.docEditor.saveText() is False
nwGUI.docEditor._docHandle = C.hSceneDoc
@@ -181,8 +178,7 @@ def testGuiEditor_SaveText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumTex
@pytest.mark.gui
def testGuiEditor_MetaData(qtbot, nwGUI, projPath, mockRnd):
"""Test extracting various meta data and other values.
"""
"""Test extracting various meta data and other values."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -461,8 +457,7 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
@pytest.mark.gui
def testGuiEditor_Insert(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
"""Test the document insert functions.
"""
"""Test the document insert functions."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -544,8 +539,7 @@ def testGuiEditor_Insert(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd
@pytest.mark.gui
def testGuiEditor_TextManipulation(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
"""Test the text manipulation functions.
"""
"""Test the text manipulation functions."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -751,8 +745,7 @@ def testGuiEditor_TextManipulation(qtbot, monkeypatch, nwGUI, projPath, ipsumTex
@pytest.mark.gui
def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
"""Test the block formatting function.
"""
"""Test the block formatting function."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -1064,8 +1057,7 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, projPath, ipsumText
@pytest.mark.gui
def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
"""Test the document editor tags functionality.
"""
"""Test the document editor tags functionality."""
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -1123,8 +1115,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
@pytest.mark.gui
def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
"""Test saving text from the editor.
"""
"""Test saving text from the editor."""
class MockThreadPool:
def __init__(self):
@@ -1204,8 +1195,7 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
@pytest.mark.gui
def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum):
"""Test the document editor search functionality.
"""
"""Test the document editor search functionality."""
monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True)
assert nwGUI.openProject(prjLipsum) is True
@@ -1413,8 +1403,7 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum):
@pytest.mark.gui
def testGuiEditor_StaticMethods():
"""Test the document editor's static methods.
"""
"""Test the document editor's static methods."""
# Check the method that decides if it is allowed to insert a space
# before a colon using the French, Spanish, etc language feature
assert GuiDocEditor._allowSpaceBeforeColon("", "") is True
+2 -3
View File
@@ -34,8 +34,7 @@ from novelwriter.core.tohtml import ToHtml
@pytest.mark.gui
def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
"""Test the document viewer.
"""
"""Test the document viewer."""
# Open project
assert nwGUI.openProject(prjLipsum)
@@ -135,7 +134,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
nwGUI.docViewer.updateDocInfo("4c4f28287af27")
assert nwGUI.docViewer.docHeader.theTitle.text() == "Characters Test Title"
# Ttile without full path
# Title without full path
CONFIG.showFullPath = False
nwGUI.docViewer.updateDocInfo("4c4f28287af27")
assert nwGUI.docViewer.docHeader.theTitle.text() == "Test Title"
+1
View File
@@ -94,6 +94,7 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum):
# Block Formats
# =============
# cSpell:ignore Pellentesque erat nulla posuere commodo
assert nwGUI.docEditor.setCursorPosition(42)
# Header 1
+1 -1
View File
@@ -97,7 +97,7 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
assert novelTree.selectedItems()[0] == topItem
assert novelView.getSelectedHandle() == (C.hTitlePage, "T0001")
# Refresh using the slot for the butoom
# Refresh using the slot for the button
novelBar._refreshNovelTree()
assert novelTree.topLevelItem(0).isSelected()
+4 -4
View File
@@ -454,7 +454,7 @@ def testGuiProjTree_PermanentlyDeleteItem(qtbot, caplog, monkeypatch, nwGUI, pro
assert C.hTitlePage not in theProject.tree
assert nwGUI.docEditor.docHandle() is None
# Deleting folder + files recursiely is ok
# Deleting folder + files recursively is ok
assert projTree.permanentlyDeleteItem(C.hChapterDir) is True
assert C.hChapterDir not in theProject.tree
assert C.hChapterDoc not in theProject.tree
@@ -509,7 +509,7 @@ def testGuiProjTree_EmptyTrash(qtbot, caplog, monkeypatch, nwGUI, projPath, mock
assert C.hChapterDoc not in theProject.tree
assert C.hSceneDoc not in theProject.tree
# Running Emtpy Trash again is cancelled due to empty folder
# Running Empty Trash again is cancelled due to empty folder
assert projTree.emptyTrash() is False
nwGUI.closeProject()
@@ -557,7 +557,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
# No item under menu
assert projTree._openContextMenu(projTree.viewport().rect().bottomRight()) is False
# Generate the possible menu combinarions
# Generate the possible menu combinations
assert projTree._openContextMenu(itemPos(hTrashRoot)) is True
assert projTree._openContextMenu(itemPos(C.hNovelRoot)) is True
assert projTree._openContextMenu(itemPos(hNovelNote)) is True
@@ -936,7 +936,7 @@ def testGuiProjTree_Other(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
# Send invalid handle
assert projTree.revealNewTreeItem(C.hInvalid) is False
# Try to add an oprhaned file to the tree
# Try to add an orphaned file to the tree
nHandle = nwGUI.theProject.newFile("Test", C.hNovelRoot)
nwGUI.theProject.tree[nHandle].setParent(None)
assert projTree.revealNewTreeItem(nHandle) is False
+1 -1
View File
@@ -349,7 +349,7 @@ def testGuiTheme_Icons(qtbot, caplog, monkeypatch, nwGUI, tstPaths):
assert isinstance(qIcon, QIcon)
assert qIcon.isNull() is True
# Load an icon, it is likelyu already cached
# Load an icon, it is likely already cached
qIcon = iconCache.getIcon("add")
assert isinstance(qIcon, QIcon)
assert qIcon.isNull() is False