diff --git a/novelwriter/core/docbuild.py b/novelwriter/core/docbuild.py index 429bc92f..cdf610ae 100644 --- a/novelwriter/core/docbuild.py +++ b/novelwriter/core/docbuild.py @@ -35,13 +35,13 @@ from novelwriter.constants import nwLabels from novelwriter.core.buildsettings import BuildSettings from novelwriter.core.item import NWItem from novelwriter.core.project import NWProject -from novelwriter.core.tohtml import ToHtml -from novelwriter.core.tokenizer import Tokenizer -from novelwriter.core.tomarkdown import ToMarkdown -from novelwriter.core.toodt import ToOdt -from novelwriter.core.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.enum import nwBuildFmt from novelwriter.error import formatException, logException +from novelwriter.formats.tohtml import ToHtml +from novelwriter.formats.tokenizer import Tokenizer +from novelwriter.formats.tomarkdown import ToMarkdown +from novelwriter.formats.toodt import ToOdt +from novelwriter.formats.toqdoc import TextDocumentTheme, ToQTextDocument logger = logging.getLogger(__name__) diff --git a/novelwriter/core/tohtml.py b/novelwriter/formats/tohtml.py similarity index 99% rename from novelwriter/core/tohtml.py rename to novelwriter/formats/tohtml.py index d9221e29..cdf30700 100644 --- a/novelwriter/core/tohtml.py +++ b/novelwriter/formats/tohtml.py @@ -32,7 +32,7 @@ from time import time from novelwriter.common import formatTimeStamp from novelwriter.constants import nwHeadFmt, nwHtmlUnicode, nwKeyWords, nwLabels from novelwriter.core.project import NWProject -from novelwriter.core.tokenizer import T_Formats, Tokenizer, stripEscape +from novelwriter.formats.tokenizer import T_Formats, Tokenizer, stripEscape from novelwriter.types import FONT_STYLE, FONT_WEIGHTS logger = logging.getLogger(__name__) diff --git a/novelwriter/core/tokenizer.py b/novelwriter/formats/tokenizer.py similarity index 100% rename from novelwriter/core/tokenizer.py rename to novelwriter/formats/tokenizer.py diff --git a/novelwriter/core/tomarkdown.py b/novelwriter/formats/tomarkdown.py similarity index 99% rename from novelwriter/core/tomarkdown.py rename to novelwriter/formats/tomarkdown.py index eccf2300..7a9d768f 100644 --- a/novelwriter/core/tomarkdown.py +++ b/novelwriter/formats/tomarkdown.py @@ -29,7 +29,7 @@ from pathlib import Path from novelwriter.constants import nwHeadFmt, nwLabels, nwUnicode from novelwriter.core.project import NWProject -from novelwriter.core.tokenizer import T_Formats, Tokenizer +from novelwriter.formats.tokenizer import T_Formats, Tokenizer logger = logging.getLogger(__name__) diff --git a/novelwriter/core/toodt.py b/novelwriter/formats/toodt.py similarity index 99% rename from novelwriter/core/toodt.py rename to novelwriter/formats/toodt.py index 64b6579e..d2930b0e 100644 --- a/novelwriter/core/toodt.py +++ b/novelwriter/formats/toodt.py @@ -41,7 +41,7 @@ from novelwriter import __version__ from novelwriter.common import xmlIndent from novelwriter.constants import nwHeadFmt, nwKeyWords, nwLabels from novelwriter.core.project import NWProject -from novelwriter.core.tokenizer import T_Formats, Tokenizer, stripEscape +from novelwriter.formats.tokenizer import T_Formats, Tokenizer, stripEscape from novelwriter.types import FONT_STYLE, FONT_WEIGHTS logger = logging.getLogger(__name__) diff --git a/novelwriter/core/toqdoc.py b/novelwriter/formats/toqdoc.py similarity index 99% rename from novelwriter/core/toqdoc.py rename to novelwriter/formats/toqdoc.py index f8a092e6..900bb379 100644 --- a/novelwriter/core/toqdoc.py +++ b/novelwriter/formats/toqdoc.py @@ -32,7 +32,7 @@ from PyQt5.QtGui import ( from novelwriter.constants import nwHeaders, nwHeadFmt, nwKeyWords, nwLabels, nwUnicode from novelwriter.core.project import NWProject -from novelwriter.core.tokenizer import T_Formats, Tokenizer +from novelwriter.formats.tokenizer import T_Formats, Tokenizer from novelwriter.types import ( QtAlignAbsolute, QtAlignCenter, QtAlignJustify, QtAlignLeft, QtAlignRight, QtBlack, QtPageBreakAfter, QtPageBreakBefore, QtTransparent, diff --git a/novelwriter/gui/docviewer.py b/novelwriter/gui/docviewer.py index 96c5df3d..665285fa 100644 --- a/novelwriter/gui/docviewer.py +++ b/novelwriter/gui/docviewer.py @@ -39,12 +39,12 @@ from PyQt5.QtWidgets import ( from novelwriter import CONFIG, SHARED from novelwriter.constants import nwHeaders, nwUnicode -from novelwriter.core.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.enum import nwDocAction, nwDocMode, nwItemType from novelwriter.error import logException from novelwriter.extensions.configlayout import NColourLabel from novelwriter.extensions.eventfilters import WheelEventFilter from novelwriter.extensions.modified import NIconToolButton +from novelwriter.formats.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON from novelwriter.types import ( QtAlignCenterTop, QtKeepAnchor, QtMouseLeft, QtMoveAnchor, diff --git a/novelwriter/tools/manuscript.py b/novelwriter/tools/manuscript.py index 903a3839..410a33fd 100644 --- a/novelwriter/tools/manuscript.py +++ b/novelwriter/tools/manuscript.py @@ -42,10 +42,10 @@ from novelwriter import CONFIG, SHARED from novelwriter.common import fuzzyTime from novelwriter.core.buildsettings import BuildCollection, BuildSettings from novelwriter.core.docbuild import NWBuildDocument -from novelwriter.core.tokenizer import HeadingFormatter -from novelwriter.core.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton, NToolDialog from novelwriter.extensions.progressbars import NProgressCircle +from novelwriter.formats.tokenizer import HeadingFormatter +from novelwriter.formats.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON from novelwriter.tools.manusbuild import GuiManuscriptBuild from novelwriter.tools.manussettings import GuiBuildSettings diff --git a/tests/test_core/test_core_docbuild.py b/tests/test_core/test_core_docbuild.py index 784630b2..54ccee79 100644 --- a/tests/test_core/test_core_docbuild.py +++ b/tests/test_core/test_core_docbuild.py @@ -30,10 +30,10 @@ import pytest from novelwriter.core.buildsettings import BuildSettings from novelwriter.core.docbuild import NWBuildDocument from novelwriter.core.project import NWProject -from novelwriter.core.tohtml import ToHtml -from novelwriter.core.tomarkdown import ToMarkdown -from novelwriter.core.toodt import ToOdt from novelwriter.enum import nwBuildFmt +from novelwriter.formats.tohtml import ToHtml +from novelwriter.formats.tomarkdown import ToMarkdown +from novelwriter.formats.toodt import ToOdt from tests.mocked import causeException, causeOSError from tests.tools import ODT_IGNORE, C, buildTestProject, cmpFiles @@ -146,7 +146,7 @@ def testCoreDocBuild_OpenDocument(monkeypatch, mockGUI, prjLipsum, fncPath, tstP # ================== with monkeypatch.context() as mp: - mp.setattr("novelwriter.core.toodt.ToOdt.doConvert", causeException) + mp.setattr("novelwriter.formats.toodt.ToOdt.doConvert", causeException) assert len(docBuild) == 21 count = 0 diff --git a/tests/test_core/test_core_tohtml.py b/tests/test_formats/test_fmt_tohtml.py similarity index 98% rename from tests/test_core/test_core_tohtml.py rename to tests/test_formats/test_fmt_tohtml.py index 7974cef4..56ceff47 100644 --- a/tests/test_core/test_core_tohtml.py +++ b/tests/test_formats/test_fmt_tohtml.py @@ -26,11 +26,11 @@ import pytest from novelwriter import CONFIG from novelwriter.core.project import NWProject -from novelwriter.core.tohtml import ToHtml +from novelwriter.formats.tohtml import ToHtml @pytest.mark.core -def testCoreToHtml_ConvertHeaders(mockGUI): +def testFmtToHtml_ConvertHeaders(mockGUI): """Test header formats in the ToHtml class.""" project = NWProject() html = ToHtml(project) @@ -132,7 +132,7 @@ def testCoreToHtml_ConvertHeaders(mockGUI): @pytest.mark.core -def testCoreToHtml_ConvertParagraphs(mockGUI): +def testFmtToHtml_ConvertParagraphs(mockGUI): """Test paragraph formats in the ToHtml class.""" project = NWProject() html = ToHtml(project) @@ -309,7 +309,7 @@ def testCoreToHtml_ConvertParagraphs(mockGUI): @pytest.mark.core -def testCoreToHtml_CloseTags(mockGUI): +def testFmtToHtml_CloseTags(mockGUI): """Test automatic closing of HTML tags for shortcodes.""" project = NWProject() html = ToHtml(project) @@ -345,7 +345,7 @@ def testCoreToHtml_CloseTags(mockGUI): @pytest.mark.core -def testCoreToHtml_ConvertDirect(mockGUI): +def testFmtToHtml_ConvertDirect(mockGUI): """Test the converter directly using the ToHtml class.""" project = NWProject() html = ToHtml(project) @@ -492,7 +492,7 @@ def testCoreToHtml_ConvertDirect(mockGUI): @pytest.mark.core -def testCoreToHtml_SpecialCases(mockGUI): +def testFmtToHtml_SpecialCases(mockGUI): """Test some special cases that have caused errors in the past.""" project = NWProject() html = ToHtml(project) @@ -564,7 +564,7 @@ def testCoreToHtml_SpecialCases(mockGUI): @pytest.mark.core -def testCoreToHtml_Save(mockGUI, fncPath): +def testFmtToHtml_Save(mockGUI, fncPath): """Test the save method of the ToHtml class.""" project = NWProject() html = ToHtml(project) @@ -660,7 +660,7 @@ def testCoreToHtml_Save(mockGUI, fncPath): @pytest.mark.core -def testCoreToHtml_Methods(mockGUI): +def testFmtToHtml_Methods(mockGUI): """Test all the other methods of the ToHtml class.""" project = NWProject() html = ToHtml(project) @@ -707,7 +707,7 @@ def testCoreToHtml_Methods(mockGUI): @pytest.mark.core -def testCoreToHtml_Format(mockGUI): +def testFmtToHtml_Format(mockGUI): """Test all the formatters for the ToHtml class.""" project = NWProject() html = ToHtml(project) diff --git a/tests/test_core/test_core_tokenizer.py b/tests/test_formats/test_fmt_tokenizer.py similarity index 98% rename from tests/test_core/test_core_tokenizer.py rename to tests/test_formats/test_fmt_tokenizer.py index 3eef5e9c..819e51c0 100644 --- a/tests/test_core/test_core_tokenizer.py +++ b/tests/test_formats/test_fmt_tokenizer.py @@ -29,8 +29,8 @@ from PyQt5.QtGui import QFont from novelwriter import CONFIG from novelwriter.constants import nwHeadFmt from novelwriter.core.project import NWProject -from novelwriter.core.tokenizer import HeadingFormatter, Tokenizer, stripEscape -from novelwriter.core.tomarkdown import ToMarkdown +from novelwriter.formats.tokenizer import HeadingFormatter, Tokenizer, stripEscape +from novelwriter.formats.tomarkdown import ToMarkdown from tests.tools import C, buildTestProject, readFile @@ -41,7 +41,7 @@ class BareTokenizer(Tokenizer): @pytest.mark.core -def testCoreToken_Setters(mockGUI): +def testFmtToken_Setters(mockGUI): """Test all the setters for the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -152,7 +152,7 @@ def testCoreToken_Setters(mockGUI): @pytest.mark.core -def testCoreToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath): +def testFmtToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath): """Test handling files and text in the Tokenizer class.""" project = NWProject() mockRnd.reset() @@ -238,7 +238,7 @@ def testCoreToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath): @pytest.mark.core -def testCoreToken_StripEscape(): +def testFmtToken_StripEscape(): """Test the stripEscape helper function.""" text1 = "This is text with escapes: \\** \\~~ \\__" text2 = "This is text with escapes: ** ~~ __" @@ -247,7 +247,7 @@ def testCoreToken_StripEscape(): @pytest.mark.core -def testCoreToken_HeaderFormat(mockGUI): +def testFmtToken_HeaderFormat(mockGUI): """Test the tokenization of header formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -422,7 +422,7 @@ def testCoreToken_HeaderFormat(mockGUI): @pytest.mark.core -def testCoreToken_HeaderStyle(mockGUI): +def testFmtToken_HeaderStyle(mockGUI): """Test the styling of headers in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -683,7 +683,7 @@ def testCoreToken_HeaderStyle(mockGUI): @pytest.mark.core -def testCoreToken_MetaFormat(mockGUI): +def testFmtToken_MetaFormat(mockGUI): """Test the tokenization of meta formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -771,7 +771,7 @@ def testCoreToken_MetaFormat(mockGUI): @pytest.mark.core -def testCoreToken_MarginFormat(mockGUI): +def testFmtToken_MarginFormat(mockGUI): """Test the tokenization of margin formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -814,7 +814,7 @@ def testCoreToken_MarginFormat(mockGUI): @pytest.mark.core -def testCoreToken_ExtractFormats(mockGUI): +def testFmtToken_ExtractFormats(mockGUI): """Test the extraction of formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -921,7 +921,7 @@ def testCoreToken_ExtractFormats(mockGUI): @pytest.mark.core -def testCoreToken_Paragraphs(mockGUI): +def testFmtToken_Paragraphs(mockGUI): """Test the splitting of paragraphs.""" project = NWProject() tokens = BareTokenizer(project) @@ -994,7 +994,7 @@ def testCoreToken_Paragraphs(mockGUI): @pytest.mark.core -def testCoreToken_TextFormat(mockGUI): +def testFmtToken_TextFormat(mockGUI): """Test the tokenization of text formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -1085,7 +1085,7 @@ def testCoreToken_TextFormat(mockGUI): @pytest.mark.core -def testCoreToken_Dialogue(mockGUI): +def testFmtToken_Dialogue(mockGUI): """Test the tokenization of dialogue in the Tokenizer class.""" CONFIG.fmtDQuoteOpen = "\u201c" CONFIG.fmtDQuoteClose = "\u201d" @@ -1182,7 +1182,7 @@ def testCoreToken_Dialogue(mockGUI): @pytest.mark.core -def testCoreToken_SpecialFormat(mockGUI): +def testFmtToken_SpecialFormat(mockGUI): """Test the tokenization of special formats in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -1344,7 +1344,7 @@ def testCoreToken_SpecialFormat(mockGUI): @pytest.mark.core -def testCoreToken_TextIndent(mockGUI): +def testFmtToken_TextIndent(mockGUI): """Test the handling of text indent in the Tokenizer class.""" project = NWProject() tokens = BareTokenizer(project) @@ -1427,7 +1427,7 @@ def testCoreToken_TextIndent(mockGUI): @pytest.mark.core -def testCoreToken_ProcessHeaders(mockGUI): +def testFmtToken_ProcessHeaders(mockGUI): """Test the header and page parser of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -1616,7 +1616,7 @@ def testCoreToken_ProcessHeaders(mockGUI): @pytest.mark.core -def testCoreToken_BuildOutline(mockGUI, ipsumText): +def testFmtToken_BuildOutline(mockGUI, ipsumText): """Test stats counter of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -1680,7 +1680,7 @@ def testCoreToken_BuildOutline(mockGUI, ipsumText): @pytest.mark.core -def testCoreToken_CountStats(mockGUI, ipsumText): +def testFmtToken_CountStats(mockGUI, ipsumText): """Test stats counter of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -1876,7 +1876,7 @@ def testCoreToken_CountStats(mockGUI, ipsumText): @pytest.mark.core -def testCoreToken_SceneSeparators(mockGUI): +def testFmtToken_SceneSeparators(mockGUI): """Test the section and scene separators of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -2027,7 +2027,7 @@ def testCoreToken_SceneSeparators(mockGUI): @pytest.mark.core -def testCoreToken_HeaderVisibility(mockGUI): +def testFmtToken_HeaderVisibility(mockGUI): """Test the heading visibility settings of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -2139,7 +2139,7 @@ def testCoreToken_HeaderVisibility(mockGUI): @pytest.mark.core -def testCoreToken_CounterHandling(mockGUI): +def testFmtToken_CounterHandling(mockGUI): """Test the heading counter of the Tokenizer class.""" project = NWProject() project.data.setLanguage("en") @@ -2224,7 +2224,7 @@ def testCoreToken_CounterHandling(mockGUI): @pytest.mark.core -def testCoreToken_HeadingFormatter(fncPath, mockGUI, mockRnd): +def testFmtToken_HeadingFormatter(fncPath, mockGUI, mockRnd): """Check the HeadingFormatter class.""" project = NWProject() project.setProjectLang("en_GB") diff --git a/tests/test_core/test_core_tomarkdown.py b/tests/test_formats/test_fmt_tomarkdown.py similarity index 96% rename from tests/test_core/test_core_tomarkdown.py rename to tests/test_formats/test_fmt_tomarkdown.py index 8ef04caf..d5ac9256 100644 --- a/tests/test_core/test_core_tomarkdown.py +++ b/tests/test_formats/test_fmt_tomarkdown.py @@ -23,11 +23,11 @@ from __future__ import annotations import pytest from novelwriter.core.project import NWProject -from novelwriter.core.tomarkdown import ToMarkdown +from novelwriter.formats.tomarkdown import ToMarkdown @pytest.mark.core -def testCoreToMarkdown_ConvertHeaders(mockGUI): +def testFmtToMarkdown_ConvertHeaders(mockGUI): """Test header formats in the ToMarkdown class.""" project = NWProject() toMD = ToMarkdown(project) @@ -73,7 +73,7 @@ def testCoreToMarkdown_ConvertHeaders(mockGUI): @pytest.mark.core -def testCoreToMarkdown_ConvertParagraphs(mockGUI): +def testFmtToMarkdown_ConvertParagraphs(mockGUI): """Test paragraph formats in the ToMarkdown class.""" project = NWProject() toMD = ToMarkdown(project) @@ -209,7 +209,7 @@ def testCoreToMarkdown_ConvertParagraphs(mockGUI): @pytest.mark.core -def testCoreToMarkdown_ConvertDirect(mockGUI): +def testFmtToMarkdown_ConvertDirect(mockGUI): """Test the converter directly using the ToMarkdown class.""" project = NWProject() toMD = ToMarkdown(project) @@ -246,7 +246,7 @@ def testCoreToMarkdown_ConvertDirect(mockGUI): @pytest.mark.core -def testCoreToMarkdown_Save(mockGUI, fncPath): +def testFmtToMarkdown_Save(mockGUI, fncPath): """Test the save method of the ToMarkdown class.""" project = NWProject() toMD = ToMarkdown(project) @@ -298,7 +298,7 @@ def testCoreToMarkdown_Save(mockGUI, fncPath): @pytest.mark.core -def testCoreToMarkdown_Format(mockGUI): +def testFmtToMarkdown_Format(mockGUI): """Test all the formatters for the ToMarkdown class.""" project = NWProject() toMD = ToMarkdown(project) diff --git a/tests/test_core/test_core_toodt.py b/tests/test_formats/test_fmt_toodt.py similarity index 98% rename from tests/test_core/test_core_toodt.py rename to tests/test_formats/test_fmt_toodt.py index d1c524c8..2f893cd0 100644 --- a/tests/test_core/test_core_toodt.py +++ b/tests/test_formats/test_fmt_toodt.py @@ -30,7 +30,7 @@ import pytest from novelwriter.common import xmlIndent from novelwriter.constants import nwHeadFmt from novelwriter.core.project import NWProject -from novelwriter.core.toodt import ODTParagraphStyle, ODTTextStyle, ToOdt, XMLParagraph, _mkTag +from novelwriter.formats.toodt import ODTParagraphStyle, ODTTextStyle, ToOdt, XMLParagraph, _mkTag from tests.tools import ODT_IGNORE, cmpFiles @@ -54,7 +54,7 @@ def xmlToText(xElem): @pytest.mark.core -def testCoreToOdt_Init(mockGUI): +def testFmtToOdt_Init(mockGUI): """Test initialisation of the ODT document.""" project = NWProject() @@ -106,7 +106,7 @@ def testCoreToOdt_Init(mockGUI): @pytest.mark.core -def testCoreToOdt_TextFormatting(mockGUI): +def testFmtToOdt_TextFormatting(mockGUI): """Test formatting of paragraphs.""" project = NWProject() odt = ToOdt(project, isFlat=True) @@ -235,7 +235,7 @@ def testCoreToOdt_TextFormatting(mockGUI): @pytest.mark.core -def testCoreToOdt_DialogueFormatting(mockGUI): +def testFmtToOdt_DialogueFormatting(mockGUI): """Test formatting of dialogue.""" project = NWProject() odt = ToOdt(project, isFlat=True) @@ -271,7 +271,7 @@ def testCoreToOdt_DialogueFormatting(mockGUI): @pytest.mark.core -def testCoreToOdt_ConvertHeaders(mockGUI): +def testFmtToOdt_ConvertHeaders(mockGUI): """Test the converter of the ToOdt class.""" project = NWProject() odt = ToOdt(project, isFlat=True) @@ -358,7 +358,7 @@ def testCoreToOdt_ConvertHeaders(mockGUI): @pytest.mark.core -def testCoreToOdt_ConvertParagraphs(mockGUI): +def testFmtToOdt_ConvertParagraphs(mockGUI): """Test the converter of the ToOdt class.""" project = NWProject() odt = ToOdt(project, isFlat=True) @@ -706,7 +706,7 @@ def testCoreToOdt_ConvertParagraphs(mockGUI): @pytest.mark.core -def testCoreToOdt_ConvertDirect(mockGUI): +def testFmtToOdt_ConvertDirect(mockGUI): """Test the converter directly using the ToOdt class to reach some otherwise hard to reach conditions. """ @@ -757,7 +757,7 @@ def testCoreToOdt_ConvertDirect(mockGUI): @pytest.mark.core -def testCoreToOdt_SaveFlat(mockGUI, fncPath, tstPaths): +def testFmtToOdt_SaveFlat(mockGUI, fncPath, tstPaths): """Test the document save functions.""" project = NWProject() project.data.setAuthor("Jane Smith") @@ -812,7 +812,7 @@ def testCoreToOdt_SaveFlat(mockGUI, fncPath, tstPaths): @pytest.mark.core -def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths): +def testFmtToOdt_SaveFull(mockGUI, fncPath, tstPaths): """Test the document save functions.""" project = NWProject() project.data.setAuthor("Jane Smith") @@ -890,7 +890,7 @@ def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths): @pytest.mark.core -def testCoreToOdt_SpecialFormats(mockGUI): +def testFmtToOdt_SpecialFormats(mockGUI): """Test the special formatters for the ToOdt class.""" project = NWProject() odt = ToOdt(project, isFlat=True) @@ -921,7 +921,7 @@ def testCoreToOdt_SpecialFormats(mockGUI): @pytest.mark.core -def testCoreToOdt_ODTParagraphStyle(): +def testFmtToOdt_ODTParagraphStyle(): """Test the ODTParagraphStyle class.""" parStyle = ODTParagraphStyle("test") @@ -1158,7 +1158,7 @@ def testCoreToOdt_ODTParagraphStyle(): @pytest.mark.core -def testCoreToOdt_ODTTextStyle(): +def testFmtToOdt_ODTTextStyle(): """Test the ODTTextStyle class.""" txtStyle = ODTTextStyle("test") @@ -1308,7 +1308,7 @@ def testCoreToOdt_ODTTextStyle(): @pytest.mark.core -def testCoreToOdt_XMLParagraph(): +def testFmtToOdt_XMLParagraph(): """Test XML encoding of paragraph.""" # Stage 1 : Text # ============== @@ -1497,7 +1497,7 @@ def testCoreToOdt_XMLParagraph(): @pytest.mark.core -def testCoreToOdt_MkTag(): +def testFmtToOdt_MkTag(): """Test the tag maker function.""" assert _mkTag("office", "text") == "{urn:oasis:names:tc:opendocument:xmlns:office:1.0}text" assert _mkTag("style", "text") == "{urn:oasis:names:tc:opendocument:xmlns:style:1.0}text" diff --git a/tests/test_core/test_core_toqdoc.py b/tests/test_formats/test_fmt_toqdoc.py similarity index 97% rename from tests/test_core/test_core_toqdoc.py rename to tests/test_formats/test_fmt_toqdoc.py index b83badbe..62211ae1 100644 --- a/tests/test_core/test_core_toqdoc.py +++ b/tests/test_formats/test_fmt_toqdoc.py @@ -27,7 +27,7 @@ from PyQt5.QtGui import QColor, QTextBlock, QTextCharFormat, QTextCursor from novelwriter import CONFIG from novelwriter.constants import nwUnicode from novelwriter.core.project import NWProject -from novelwriter.core.toqdoc import TextDocumentTheme, ToQTextDocument +from novelwriter.formats.toqdoc import TextDocumentTheme, ToQTextDocument from novelwriter.types import ( QtAlignAbsolute, QtAlignCenter, QtAlignJustify, QtAlignLeft, QtAlignRight, QtPageBreakAfter, QtTransparent, QtVAlignNormal, QtVAlignSub, QtVAlignSuper @@ -56,7 +56,7 @@ def charFmtInBlock(block: QTextBlock, pos: int) -> QTextCharFormat: @pytest.mark.core -def testCoreToQTextDocument_ConvertHeaders(mockGUI): +def testFmtToQTextDocument_ConvertHeaders(mockGUI): """Test header formats in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) @@ -132,7 +132,7 @@ def testCoreToQTextDocument_ConvertHeaders(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_SeparatorSkip(mockGUI): +def testFmtToQTextDocument_SeparatorSkip(mockGUI): """Test separator and skip in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) @@ -198,7 +198,7 @@ def testCoreToQTextDocument_SeparatorSkip(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_NovelMeta(mockGUI): +def testFmtToQTextDocument_NovelMeta(mockGUI): """Test novel meta formats in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) @@ -275,7 +275,7 @@ def testCoreToQTextDocument_NovelMeta(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_NoteMeta(mockGUI): +def testFmtToQTextDocument_NoteMeta(mockGUI): """Test note meta formats in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) @@ -332,7 +332,7 @@ def testCoreToQTextDocument_NoteMeta(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_TextBlockFormats(mockGUI): +def testFmtToQTextDocument_TextBlockFormats(mockGUI): """Test text block formats in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) @@ -441,7 +441,7 @@ def testCoreToQTextDocument_TextBlockFormats(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_TextCharFormats(mockGUI): +def testFmtToQTextDocument_TextCharFormats(mockGUI): """Test text char formats in the ToQTextDocument class.""" CONFIG.fmtDQuoteOpen = nwUnicode.U_LDQUO CONFIG.fmtDQuoteClose = nwUnicode.U_RDQUO @@ -576,7 +576,7 @@ def testCoreToQTextDocument_TextCharFormats(mockGUI): @pytest.mark.core -def testCoreToQTextDocument_Footnotes(mockGUI): +def testFmtToQTextDocument_Footnotes(mockGUI): """Test footnotes in the ToQTextDocument class.""" project = NWProject() qdoc = ToQTextDocument(project) diff --git a/tests/test_gui/test_gui_docviewer.py b/tests/test_gui/test_gui_docviewer.py index f3a39a45..34a559f3 100644 --- a/tests/test_gui/test_gui_docviewer.py +++ b/tests/test_gui/test_gui_docviewer.py @@ -27,8 +27,8 @@ from PyQt5.QtGui import QMouseEvent, QTextCursor from PyQt5.QtWidgets import QAction, QApplication, QMenu from novelwriter import CONFIG, SHARED -from novelwriter.core.toqdoc import ToQTextDocument from novelwriter.enum import nwDocAction +from novelwriter.formats.toqdoc import ToQTextDocument from novelwriter.gui.docviewer import GuiDocViewer from novelwriter.types import QtModNone, QtMouseLeft