Merge branch 'main' into release_0.12

This commit is contained in:
Veronica K. B. Olsen
2020-08-14 20:20:51 +02:00
14 changed files with 168 additions and 147 deletions
+1 -2
View File
@@ -1,9 +1,8 @@
--- ---
name: Bug Report name: Bug Report
about: Create a report to help us improve about: Create a report to help us improve
title: "[BUG]" title: ""
labels: bug labels: bug
assignees: vkbo
--- ---
**Describe the Bug** **Describe the Bug**
+5 -6
View File
@@ -1,19 +1,18 @@
--- ---
name: Feature Request name: Feature Request
about: Suggest an idea for this project about: Suggest an idea for this project
title: "[FEATURE]" title: ""
labels: enhancement labels: enhancement
assignees: vkbo
--- ---
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe:**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like:**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.
**Describe alternatives you've considered** **Describe alternatives you've considered:**
A clear and concise description of any alternative solutions or features you've considered. A clear and concise description of any alternative solutions or features you've considered.
**Additional context** **Additional context:**
Add any other context or screenshots about the feature request here. Add any other context or screenshots about the feature request here.
+4 -4
View File
@@ -1,4 +1,4 @@
name: Flake 8 Checks name: Flake8 Checks
on: on:
push: push:
@@ -19,9 +19,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install flake8 - name: Install flake8
run: pip install flake8 run: pip install flake8
- name: Check for Syntax Error on novelWriter - name: Check for Syntax Error in novelWriter
run: flake8 nw --count --select=E9,F63,F7,F82 --show-source --statistics run: flake8 nw --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check for Syntax Error on Tests - name: Check for Syntax Error in Tests
run: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics run: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check for Code Style on novelWriter - name: Check for Code Style Violations
run: flake8 nw --count --max-line-length=99 --ignore E203,E221,E226,E241,E251,E261,E266,E302,E305 --show-source --statistics run: flake8 nw --count --max-line-length=99 --ignore E203,E221,E226,E241,E251,E261,E266,E302,E305 --show-source --statistics
+8 -12
View File
@@ -1,9 +1,10 @@
os: linux os: linux
dist: bionic dist: focal
services: services:
- xvfb - xvfb
language: python language: python
cache: bundler cache:
- bundler
addons: addons:
apt: apt:
@@ -30,10 +31,8 @@ stages:
jobs: jobs:
include: include:
- stage: - stage: Main
- Main python: 3.8
python:
- 3.8
script: script:
- python -m pytest --cov=nw -v - python -m pytest --cov=nw -v
after_success: after_success:
@@ -41,15 +40,12 @@ jobs:
after_failure: after_failure:
- cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes - cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
- stage: - stage: Supported
- Supported python: 3.6
python:
- 3.6
script: script:
- python -m pytest -v - python -m pytest -v
- python: - python: 3.7
- 3.7
script: script:
- python -m pytest -v - python -m pytest -v
+2 -1
View File
@@ -3,8 +3,9 @@
[![Build Status](https://travis-ci.com/vkbo/novelWriter.svg?branch=main)](https://travis-ci.com/vkbo/novelWriter) [![Build Status](https://travis-ci.com/vkbo/novelWriter.svg?branch=main)](https://travis-ci.com/vkbo/novelWriter)
[![codecov](https://codecov.io/gh/vkbo/novelWriter/branch/main/graph/badge.svg)](https://codecov.io/gh/vkbo/novelWriter) [![codecov](https://codecov.io/gh/vkbo/novelWriter/branch/main/graph/badge.svg)](https://codecov.io/gh/vkbo/novelWriter)
[![Documentation Status](https://readthedocs.org/projects/novelwriter/badge/?version=latest)](https://novelwriter.readthedocs.io/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/novelwriter/badge/?version=latest)](https://novelwriter.readthedocs.io/en/latest/?badge=latest)
[![Flake8 Checks](https://github.com/vkbo/novelWriter/workflows/Flake8%20Checks/badge.svg)](https://github.com/vkbo/novelWriter/actions)
[![PyPI](https://img.shields.io/pypi/v/novelwriter)](https://pypi.org/project/novelWriter/) [![PyPI](https://img.shields.io/pypi/v/novelwriter)](https://pypi.org/project/novelWriter/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/novelwriter)](https://pypi.org/project/novelWriter/) [![Python Version](https://img.shields.io/pypi/pyversions/novelwriter)](https://pypi.org/project/novelWriter/)
<img align="left" style="margin: 0 16px 4px 0;" src="https://raw.githubusercontent.com/vkbo/novelWriter/main/assets/icons/96x96/novelwriter.png"> <img align="left" style="margin: 0 16px 4px 0;" src="https://raw.githubusercontent.com/vkbo/novelWriter/main/assets/icons/96x96/novelwriter.png">
+3 -1
View File
@@ -2,7 +2,9 @@
"""novelWriter Test Config """novelWriter Test Config
""" """
import sys, pytest, shutil import sys
import pytest
import shutil
from os import path, mkdir from os import path, mkdir
sys.path.insert(1, path.abspath(path.join(path.dirname(__file__), path.pardir))) sys.path.insert(1, path.abspath(path.join(path.dirname(__file__), path.pardir)))
-2
View File
@@ -2,8 +2,6 @@
"""novelWriter Test Dummy GUI Classes """novelWriter Test Dummy GUI Classes
""" """
from nw.constants import nwAlert
class DummyMain(): class DummyMain():
def __init__(self): def __init__(self):
+2 -2
View File
@@ -15,13 +15,13 @@ def ensureDir(theDir):
def cmpFiles(fileOne, fileTwo, ignoreLines=[]): def cmpFiles(fileOne, fileTwo, ignoreLines=[]):
try: try:
foOne = open(fileOne,mode="r",encoding="utf8") foOne = open(fileOne, mode="r", encoding="utf8")
except Exception as e: except Exception as e:
print(str(e)) print(str(e))
return False return False
try: try:
foTwo = open(fileTwo,mode="r",encoding="utf8") foTwo = open(fileTwo, mode="r", encoding="utf8")
except Exception as e: except Exception as e:
print(str(e)) print(str(e))
return False return False
+2 -2
View File
@@ -5,12 +5,12 @@ import pstats
from os import path from os import path
profDir = path.abspath(path.join(path.dirname(__file__),"..","prof")) profDir = path.abspath(path.join(path.dirname(__file__), path.pardir, "prof"))
print("") print("")
print("Profiles directory: %s" % profDir) print("Profiles directory: %s" % profDir)
print("") print("")
profMainWindows = pstats.Stats(path.join(profDir,"testMainWindows.prof")) profMainWindows = pstats.Stats(path.join(profDir, "testMainWindows.prof"))
profMainWindows.sort_stats("cumtime") profMainWindows.sort_stats("cumtime")
profMainWindows.print_stats("nw/") profMainWindows.print_stats("nw/")
+47 -32
View File
@@ -2,48 +2,63 @@
"""novelWriter Common Class Tester """novelWriter Common Class Tester
""" """
import nw, pytest import pytest
from nw.common import * from nw.common import checkString, checkBool, checkInt, colRange
from nwtools import cmpList from nwtools import cmpList
@pytest.mark.core @pytest.mark.core
def testCheckString(): def testCheckString():
assert checkString(None, "NotNone",True) is None assert checkString(None, "NotNone", True) is None
assert checkString("None","NotNone",True) is None assert checkString("None", "NotNone", True) is None
assert checkString("None","NotNone",False) == "None" assert checkString("None", "NotNone", False) == "None"
assert checkString(None, "NotNone",False) == "NotNone" assert checkString(None, "NotNone", False) == "NotNone"
assert checkString(1, "NotNone",False) == "NotNone" assert checkString(1, "NotNone", False) == "NotNone"
assert checkString(1.0, "NotNone",False) == "NotNone" assert checkString(1.0, "NotNone", False) == "NotNone"
assert checkString(True, "NotNone",False) == "NotNone" assert checkString(True, "NotNone", False) == "NotNone"
@pytest.mark.core @pytest.mark.core
def testCheckInt(): def testCheckInt():
assert checkInt(None, 3,True) is None assert checkInt(None, 3, True) is None
assert checkInt("None",3,True) is None assert checkInt("None", 3, True) is None
assert checkInt(None, 3,False) == 3 assert checkInt(None, 3, False) == 3
assert checkInt(1, 3,False) == 1 assert checkInt(1, 3, False) == 1
assert checkInt(1.0, 3,False) == 1 assert checkInt(1.0, 3, False) == 1
assert checkInt(True, 3,False) == 1 assert checkInt(True, 3, False) == 1
@pytest.mark.core @pytest.mark.core
def testCheckBool(): def testCheckBool():
assert checkBool(None, 3, True) is None assert checkBool(None, 3, True) is None
assert checkBool("None", 3, True) is None assert checkBool("None", 3, True) is None
assert checkBool("True", False,False) == True assert checkBool("True", False, False)
assert checkBool("False",True, False) == False assert not checkBool("False", True, False)
assert checkBool("Boo", None, False) is None assert checkBool("Boo", None, False) is None
assert checkBool(0, None, False) == False assert not checkBool(0, None, False)
assert checkBool(1, None, False) == True assert checkBool(1, None, False)
assert checkBool(2, None, False) is None assert checkBool(2, None, False) is None
assert checkBool(0.0, None, False) is None assert checkBool(0.0, None, False) is None
assert checkBool(1.0, None, False) is None assert checkBool(1.0, None, False) is None
assert checkBool(2.0, None, False) is None assert checkBool(2.0, None, False) is None
@pytest.mark.core @pytest.mark.core
def testColRange(): def testColRange():
assert colRange([0,0], [0,0], 0) is None assert colRange([0, 0], [0, 0], 0) is None
assert cmpList(colRange([200,50,0], [50,200,0], 1), [200,50,0]) assert cmpList(
assert cmpList(colRange([200,50,0], [50,200,0], 2), [[200,50,0],[50,200,0]]) colRange([200, 50, 0], [50, 200, 0], 1),
assert cmpList(colRange([200,50,0], [50,200,0], 3), [[200,50,0],[125,125,0],[50,200,0]]) [200, 50, 0]
assert cmpList(colRange([200,50,0], [50,200,0], 4), [[200,50,0],[150,100,0],[100,150,0],[50,200,0]]) )
assert cmpList(colRange([200,50,0], [50,200,0], 5), [[200,50,0],[162,87,0],[124,124,0],[86,161,0],[50,200,0]]) assert cmpList(
colRange([200, 50, 0], [50, 200, 0], 2),
[[200, 50, 0], [50, 200, 0]]
)
assert cmpList(
colRange([200, 50, 0], [50, 200, 0], 3),
[[200, 50, 0], [125, 125, 0], [50, 200, 0]]
)
assert cmpList(
colRange([200, 50, 0], [50, 200, 0], 4),
[[200, 50, 0], [150, 100, 0], [100, 150, 0], [50, 200, 0]]
)
assert cmpList(
colRange([200, 50, 0], [50, 200, 0], 5),
[[200, 50, 0], [162, 87, 0], [124, 124, 0], [86, 161, 0], [50, 200, 0]]
)
+19 -19
View File
@@ -2,16 +2,16 @@
"""novelWriter Config Class Tester """novelWriter Config Class Tester
""" """
import nw, pytest import pytest
from nwtools import * from nwtools import cmpFiles
from os import path from os import path
from nw.config import Config from nw.config import Config
theConf = Config() theConf = Config()
@pytest.mark.core @pytest.mark.core
def testConfigInit(nwTemp,nwRef): def testConfigInit(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert theConf.initConfig(nwTemp, nwTemp) assert theConf.initConfig(nwTemp, nwTemp)
assert theConf.setLastPath("") assert theConf.setLastPath("")
@@ -20,8 +20,8 @@ def testConfigInit(nwTemp,nwRef):
assert not theConf.confChanged assert not theConf.confChanged
@pytest.mark.core @pytest.mark.core
def testConfigSave(nwTemp,nwRef): def testConfigSave(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert theConf.confPath == nwTemp assert theConf.confPath == nwTemp
assert theConf.saveConfig() assert theConf.saveConfig()
@@ -31,8 +31,8 @@ def testConfigSave(nwTemp,nwRef):
@pytest.mark.core @pytest.mark.core
def testConfigSetConfPath(nwTemp): def testConfigSetConfPath(nwTemp):
assert theConf.setConfPath(None) assert theConf.setConfPath(None)
assert not theConf.setConfPath(path.join("somewhere","over","the","rainbow")) assert not theConf.setConfPath(path.join("somewhere", "over", "the", "rainbow"))
assert theConf.setConfPath(path.join(nwTemp,"novelwriter.conf")) assert theConf.setConfPath(path.join(nwTemp, "novelwriter.conf"))
assert theConf.confPath == nwTemp assert theConf.confPath == nwTemp
assert theConf.confFile == "novelwriter.conf" assert theConf.confFile == "novelwriter.conf"
assert not theConf.confChanged assert not theConf.confChanged
@@ -40,7 +40,7 @@ def testConfigSetConfPath(nwTemp):
@pytest.mark.core @pytest.mark.core
def testConfigSetDataPath(nwTemp): def testConfigSetDataPath(nwTemp):
assert theConf.setDataPath(None) assert theConf.setDataPath(None)
assert not theConf.setDataPath(path.join("somewhere","over","the","rainbow")) assert not theConf.setDataPath(path.join("somewhere", "over", "the", "rainbow"))
assert theConf.setDataPath(nwTemp) assert theConf.setDataPath(nwTemp)
assert theConf.dataPath == nwTemp assert theConf.dataPath == nwTemp
assert not theConf.confChanged assert not theConf.confChanged
@@ -51,12 +51,12 @@ def testConfigLoad():
assert not theConf.confChanged assert not theConf.confChanged
@pytest.mark.core @pytest.mark.core
def testConfigSetWinSize(nwTemp,nwRef): def testConfigSetWinSize(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert theConf.setWinSize(1105, 655) assert theConf.setWinSize(1105, 655)
assert not theConf.confChanged assert not theConf.confChanged
assert theConf.setWinSize(70,70) assert theConf.setWinSize(70, 70)
assert theConf.confChanged assert theConf.confChanged
assert theConf.setWinSize(1100, 650) assert theConf.setWinSize(1100, 650)
assert theConf.saveConfig() assert theConf.saveConfig()
@@ -64,8 +64,8 @@ def testConfigSetWinSize(nwTemp,nwRef):
assert not theConf.confChanged assert not theConf.confChanged
@pytest.mark.core @pytest.mark.core
def testConfigSetTreeColWidths(nwTemp,nwRef): def testConfigSetTreeColWidths(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert theConf.setTreeColWidths([0, 0, 0]) assert theConf.setTreeColWidths([0, 0, 0])
assert theConf.confChanged assert theConf.confChanged
@@ -76,8 +76,8 @@ def testConfigSetTreeColWidths(nwTemp,nwRef):
assert not theConf.confChanged assert not theConf.confChanged
@pytest.mark.core @pytest.mark.core
def testConfigSetPanePos(nwTemp,nwRef): def testConfigSetPanePos(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert theConf.setMainPanePos([0, 0]) assert theConf.setMainPanePos([0, 0])
assert theConf.confChanged assert theConf.confChanged
@@ -90,8 +90,8 @@ def testConfigSetPanePos(nwTemp,nwRef):
assert not theConf.confChanged assert not theConf.confChanged
@pytest.mark.core @pytest.mark.core
def testConfigFlags(nwTemp,nwRef): def testConfigFlags(nwTemp, nwRef):
tmpConf = path.join(nwTemp,"novelwriter.conf") tmpConf = path.join(nwTemp, "novelwriter.conf")
refConf = path.join(nwRef, "novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf")
assert not theConf.setShowRefPanel(False) assert not theConf.setShowRefPanel(False)
assert theConf.setShowRefPanel(True) assert theConf.setShowRefPanel(True)
@@ -102,7 +102,7 @@ def testConfigFlags(nwTemp,nwRef):
@pytest.mark.core @pytest.mark.core
def testConfigErrors(nwTemp): def testConfigErrors(nwTemp):
nonPath = path.join("somewhere","over","the","rainbow") nonPath = path.join("somewhere", "over", "the", "rainbow")
assert theConf.initConfig(nonPath, nonPath) assert theConf.initConfig(nonPath, nonPath)
assert theConf.hasError assert theConf.hasError
assert not theConf.loadConfig() assert not theConf.loadConfig()
+56 -40
View File
@@ -2,24 +2,26 @@
"""novelWriter Main GUI Class Tester """novelWriter Main GUI Class Tester
""" """
import nw, pytest, sys, json import nw
from nwtools import * import pytest
import json
from nwtools import cmpFiles
from os import path, unlink from os import path
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from nw.gui import ( from nw.gui import (
GuiProjectSettings, GuiItemEditor, GuiAbout, GuiBuildNovel, GuiProjectSettings, GuiItemEditor, GuiAbout, GuiBuildNovel,
GuiDocMerge, GuiDocSplit, GuiWritingStats, GuiProjectWizard GuiDocMerge, GuiDocSplit, GuiWritingStats, GuiProjectWizard
) )
from nw.constants import * from nw.constants import nwItemType, nwItemLayout, nwItemClass, nwDocAction
keyDelay = 2 keyDelay = 2
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp): def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -41,11 +43,11 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
assert nwGUI.theProject.projName == "" assert nwGUI.theProject.projName == ""
assert nwGUI.theProject.bookTitle == "" assert nwGUI.theProject.bookTitle == ""
assert len(nwGUI.theProject.bookAuthors) == 0 assert len(nwGUI.theProject.bookAuthors) == 0
assert nwGUI.theProject.spellCheck == False assert not nwGUI.theProject.spellCheck
# Check the files # Check the files
projFile = path.join(nwTempGUI,"nwProject.nwx") projFile = path.join(nwTempGUI, "nwProject.nwx")
assert cmpFiles(projFile, path.join(nwRef,"gui","0_nwProject.nwx"), [2, 6, 7, 8]) assert cmpFiles(projFile, path.join(nwRef, "gui", "0_nwProject.nwx"), [2, 6, 7, 8])
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
# qtbot.stopForInteraction() # qtbot.stopForInteraction()
@@ -60,12 +62,12 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
assert len(nwGUI.theProject.projTree._treeRoots) == 4 assert len(nwGUI.theProject.projTree._treeRoots) == 4
assert nwGUI.theProject.projTree.trashRoot() is None assert nwGUI.theProject.projTree.trashRoot() is None
assert nwGUI.theProject.projPath == nwTempGUI assert nwGUI.theProject.projPath == nwTempGUI
assert nwGUI.theProject.projMeta == path.join(nwTempGUI,"meta") assert nwGUI.theProject.projMeta == path.join(nwTempGUI, "meta")
assert nwGUI.theProject.projFile == "nwProject.nwx" assert nwGUI.theProject.projFile == "nwProject.nwx"
assert nwGUI.theProject.projName == "New Project" assert nwGUI.theProject.projName == "New Project"
assert nwGUI.theProject.bookTitle == "" assert nwGUI.theProject.bookTitle == ""
assert len(nwGUI.theProject.bookAuthors) == 0 assert len(nwGUI.theProject.bookAuthors) == 0
assert nwGUI.theProject.spellCheck == False assert not nwGUI.theProject.spellCheck
# Check that tree items have been created # Check that tree items have been created
assert nwGUI.treeView._getTreeItem("73475cb40a568") is not None assert nwGUI.treeView._getTreeItem("73475cb40a568") is not None
@@ -214,7 +216,10 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
for c in "This is another paragraph of much longer dummy text. It is in fact very very dumb dummy text! ": for c in (
"This is another paragraph of much longer dummy text. "
"It is in fact very very dumb dummy text! "
):
qtbot.keyClick(nwGUI.docEditor, c, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, c, delay=keyDelay)
for c in "We can also try replacing \"quotes\", even single's quotes are replaced. ": for c in "We can also try replacing \"quotes\", even single's quotes are replaced. ":
qtbot.keyClick(nwGUI.docEditor, c, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, c, delay=keyDelay)
@@ -273,7 +278,7 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp): def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -354,7 +359,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
# Check the files # Check the files
projFile = path.join(nwTempGUI,"nwProject.nwx") projFile = path.join(nwTempGUI, "nwProject.nwx")
assert cmpFiles(projFile, path.join(nwRef, "gui", "2_nwProject.nwx"), [2, 8, 9, 10]) assert cmpFiles(projFile, path.join(nwRef, "gui", "2_nwProject.nwx"), [2, 8, 9, 10])
nwGUI.closeMain() nwGUI.closeMain()
@@ -362,7 +367,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp): def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -410,7 +415,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
# Check the files # Check the files
projFile = path.join(nwTempGUI,"nwProject.nwx") projFile = path.join(nwTempGUI, "nwProject.nwx")
assert cmpFiles(projFile, path.join(nwRef, "gui", "3_nwProject.nwx"), [2, 6, 7, 8]) assert cmpFiles(projFile, path.join(nwRef, "gui", "3_nwProject.nwx"), [2, 6, 7, 8])
nwGUI.closeMain() nwGUI.closeMain()
@@ -418,7 +423,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testWritingStatsExport(qtbot, nwTempGUI, nwRef, nwTemp): def testWritingStatsExport(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -527,7 +532,7 @@ def testWritingStatsExport(qtbot, nwTempGUI, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testAboutBox(qtbot, nwTempGUI, nwRef, nwTemp): def testAboutBox(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -545,7 +550,7 @@ def testAboutBox(qtbot, nwTempGUI, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testBuildTool(qtbot, nwTempBuild, nwLipsum, nwRef, nwTemp): def testBuildTool(qtbot, nwTempBuild, nwLipsum, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempBuild, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempBuild, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -634,7 +639,7 @@ def testBuildTool(qtbot, nwTempBuild, nwLipsum, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testMergeTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp): def testMergeTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -664,7 +669,7 @@ def testMergeTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testSplitTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp): def testSplitTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -749,7 +754,7 @@ def testNewProjectWizard(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
ProjWizardCustomPage, ProjWizardFinalPage ProjWizardCustomPage, ProjWizardFinalPage
) )
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -849,7 +854,7 @@ def testNewProjectWizard(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
assert projData["popCustom"] == (wStep == 1) assert projData["popCustom"] == (wStep == 1)
assert projData["popSample"] == (wStep == 2) assert projData["popSample"] == (wStep == 2)
if wStep == 1: if wStep == 1:
assert projData["addRoots"] == [ assert projData["addRoots"] == [
nwItemClass.PLOT, nwItemClass.PLOT,
nwItemClass.CHARACTER, nwItemClass.CHARACTER,
nwItemClass.WORLD, nwItemClass.WORLD,
@@ -858,13 +863,13 @@ def testNewProjectWizard(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
nwItemClass.ENTITY, nwItemClass.ENTITY,
] ]
assert projData["numChapters"] == 5 assert projData["numChapters"] == 5
assert projData["numScenes"] == 5 assert projData["numScenes"] == 5
assert projData["chFolders"] == True assert projData["chFolders"]
else: else:
assert projData["addRoots"] == [] assert projData["addRoots"] == []
assert projData["numChapters"] == 0 assert projData["numChapters"] == 0
assert projData["numScenes"] == 0 assert projData["numScenes"] == 0
assert projData["chFolders"] == False assert not projData["chFolders"]
# qtbot.stopForInteraction() # qtbot.stopForInteraction()
nwGUI.closeMain() nwGUI.closeMain()
@@ -872,7 +877,7 @@ def testNewProjectWizard(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
@pytest.mark.gui @pytest.mark.gui
def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp): def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
qtbot.addWidget(nwGUI) qtbot.addWidget(nwGUI)
nwGUI.show() nwGUI.show()
qtbot.waitForWindowShown(nwGUI) qtbot.waitForWindowShown(nwGUI)
@@ -890,7 +895,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Bold # Bold
assert nwGUI.passDocumentAction(nwDocAction.STRONG) assert nwGUI.passDocumentAction(nwDocAction.STRONG)
assert nwGUI.docEditor.getText()[27:78] == "**Pellentesque** nec erat ut nulla posuere commodo." fmtStr = "**Pellentesque** nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:78] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.STRONG) assert nwGUI.passDocumentAction(nwDocAction.STRONG)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -898,7 +904,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Italic # Italic
assert nwGUI.passDocumentAction(nwDocAction.EMPH) assert nwGUI.passDocumentAction(nwDocAction.EMPH)
assert nwGUI.docEditor.getText()[27:76] == "_Pellentesque_ nec erat ut nulla posuere commodo." fmtStr = "_Pellentesque_ nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.EMPH) assert nwGUI.passDocumentAction(nwDocAction.EMPH)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -906,7 +913,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Strikethrough # Strikethrough
assert nwGUI.passDocumentAction(nwDocAction.STRIKE) assert nwGUI.passDocumentAction(nwDocAction.STRIKE)
assert nwGUI.docEditor.getText()[27:78] == "~~Pellentesque~~ nec erat ut nulla posuere commodo." fmtStr = "~~Pellentesque~~ nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:78] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.STRIKE) assert nwGUI.passDocumentAction(nwDocAction.STRIKE)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -925,7 +933,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Double Quotes # Double Quotes
assert nwGUI.passDocumentAction(nwDocAction.D_QUOTE) assert nwGUI.passDocumentAction(nwDocAction.D_QUOTE)
assert nwGUI.docEditor.getText()[27:76] == "“Pellentesque” nec erat ut nulla posuere commodo." fmtStr = "“Pellentesque” nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.UNDO) assert nwGUI.passDocumentAction(nwDocAction.UNDO)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -933,7 +942,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Single Quotes # Single Quotes
assert nwGUI.passDocumentAction(nwDocAction.S_QUOTE) assert nwGUI.passDocumentAction(nwDocAction.S_QUOTE)
assert nwGUI.docEditor.getText()[27:76] == "Pellentesque nec erat ut nulla posuere commodo." fmtStr = "Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.UNDO) assert nwGUI.passDocumentAction(nwDocAction.UNDO)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -942,22 +952,27 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Block Formats # Block Formats
assert nwGUI.docEditor.setCursorPosition(30) assert nwGUI.docEditor.setCursorPosition(30)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H1) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H1)
assert nwGUI.docEditor.getText()[27:76] == "# Pellentesque nec erat ut nulla posuere commodo." fmtStr = "# Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H2) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H2)
assert nwGUI.docEditor.getText()[27:77] == "## Pellentesque nec erat ut nulla posuere commodo." fmtStr = "## Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:77] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H3) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H3)
assert nwGUI.docEditor.getText()[27:78] == "### Pellentesque nec erat ut nulla posuere commodo." fmtStr = "### Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:78] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H4) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H4)
assert nwGUI.docEditor.getText()[27:79] == "#### Pellentesque nec erat ut nulla posuere commodo." fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:79] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_COM) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_COM)
assert nwGUI.docEditor.getText()[27:76] == "% Pellentesque nec erat ut nulla posuere commodo." fmtStr = "% Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT) assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
@@ -965,7 +980,8 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
# Undo/Redo # Undo/Redo
assert nwGUI.passDocumentAction(nwDocAction.UNDO) assert nwGUI.passDocumentAction(nwDocAction.UNDO)
assert nwGUI.docEditor.getText()[27:76] == "% Pellentesque nec erat ut nulla posuere commodo." fmtStr = "% Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
assert nwGUI.passDocumentAction(nwDocAction.REDO) assert nwGUI.passDocumentAction(nwDocAction.REDO)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
-1
View File
@@ -2,7 +2,6 @@
"""novelWriter NWItem Class Tester """novelWriter NWItem Class Tester
""" """
import nw
import pytest import pytest
from lxml import etree from lxml import etree
+19 -23
View File
@@ -2,11 +2,10 @@
"""novelWriter Project Class Tester """novelWriter Project Class Tester
""" """
import nw
import pytest import pytest
from os import path from os import path
from nwtools import * from nwtools import cmpFiles
from nwdummy import DummyMain from nwdummy import DummyMain
from nw.config import Config from nw.config import Config
@@ -23,8 +22,8 @@ theProject.projTree.setSeed(42)
@pytest.mark.project @pytest.mark.project
def testProjectNewMinimal(nwTempProj, nwRef, nwTemp): def testProjectNewMinimal(nwTempProj, nwRef, nwTemp):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
refFile = path.join(nwRef,"proj", "1_nwProject.nwx") refFile = path.join(nwRef, "proj", "1_nwProject.nwx")
assert theConf.initConfig(nwRef, nwTemp) assert theConf.initConfig(nwRef, nwTemp)
assert theProject.newProject({"projPath": nwTempProj}) assert theProject.newProject({"projPath": nwTempProj})
assert theProject.setProjectPath(nwTempProj) assert theProject.setProjectPath(nwTempProj)
@@ -34,22 +33,22 @@ def testProjectNewMinimal(nwTempProj, nwRef, nwTemp):
@pytest.mark.project @pytest.mark.project
def testProjectOpen(nwTempProj): def testProjectOpen(nwTempProj):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
@pytest.mark.project @pytest.mark.project
def testProjectSave(nwTempProj,nwRef): def testProjectSave(nwTempProj, nwRef):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
refFile = path.join(nwRef,"proj","1_nwProject.nwx") refFile = path.join(nwRef, "proj", "1_nwProject.nwx")
assert theProject.saveProject() assert theProject.saveProject()
assert theProject.closeProject() assert theProject.closeProject()
assert cmpFiles(projFile, refFile, [2, 6, 7, 8]) assert cmpFiles(projFile, refFile, [2, 6, 7, 8])
assert not theProject.projChanged assert not theProject.projChanged
@pytest.mark.project @pytest.mark.project
def testProjectOpenTwice(nwTempProj,nwRef): def testProjectOpenTwice(nwTempProj, nwRef):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
refFile = path.join(nwRef,"proj","1_nwProject.nwx") refFile = path.join(nwRef, "proj", "1_nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
assert not theProject.openProject(projFile) assert not theProject.openProject(projFile)
assert theProject.openProject(projFile, overrideLock=True) assert theProject.openProject(projFile, overrideLock=True)
@@ -58,9 +57,9 @@ def testProjectOpenTwice(nwTempProj,nwRef):
assert cmpFiles(projFile, refFile, [2, 6, 7, 8]) assert cmpFiles(projFile, refFile, [2, 6, 7, 8])
@pytest.mark.project @pytest.mark.project
def testProjectNewRoot(nwTempProj,nwRef): def testProjectNewRoot(nwTempProj, nwRef):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
refFile = path.join(nwRef,"proj","2_nwProject.nwx") refFile = path.join(nwRef, "proj", "2_nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
assert isinstance(theProject.newRoot("Novel", nwItemClass.NOVEL), type(None)) assert isinstance(theProject.newRoot("Novel", nwItemClass.NOVEL), type(None))
assert isinstance(theProject.newRoot("Plot", nwItemClass.PLOT), type(None)) assert isinstance(theProject.newRoot("Plot", nwItemClass.PLOT), type(None))
@@ -77,9 +76,9 @@ def testProjectNewRoot(nwTempProj,nwRef):
assert not theProject.projChanged assert not theProject.projChanged
@pytest.mark.project @pytest.mark.project
def testProjectNewFile(nwTempProj,nwRef): def testProjectNewFile(nwTempProj, nwRef):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
refFile = path.join(nwRef,"proj","3_nwProject.nwx") refFile = path.join(nwRef, "proj", "3_nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
assert isinstance(theProject.newFile("Hello", nwItemClass.NOVEL, "73475cb40a568"), str) assert isinstance(theProject.newFile("Hello", nwItemClass.NOVEL, "73475cb40a568"), str)
assert isinstance(theProject.newFile("Jane", nwItemClass.CHARACTER, "71ee45a3c0db9"), str) assert isinstance(theProject.newFile("Jane", nwItemClass.CHARACTER, "71ee45a3c0db9"), str)
@@ -91,11 +90,10 @@ def testProjectNewFile(nwTempProj,nwRef):
@pytest.mark.project @pytest.mark.project
def testIndexScanThis(nwTempProj): def testIndexScanThis(nwTempProj):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
theIndex = NWIndex(theProject, theMain) theIndex = NWIndex(theProject, theMain)
tHandle = "31489056e0916"
isValid, theBits, thePos = theIndex.scanThis("tag: this, and this") isValid, theBits, thePos = theIndex.scanThis("tag: this, and this")
assert not isValid assert not isValid
@@ -138,7 +136,7 @@ def testIndexScanThis(nwTempProj):
@pytest.mark.project @pytest.mark.project
def testIndexCheckThese(nwTempProj): def testIndexCheckThese(nwTempProj):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
theIndex = NWIndex(theProject, theMain) theIndex = NWIndex(theProject, theMain)
@@ -171,14 +169,12 @@ def testIndexCheckThese(nwTempProj):
@pytest.mark.project @pytest.mark.project
def testIndexMeta(nwTempProj): def testIndexMeta(nwTempProj):
projFile = path.join(nwTempProj,"nwProject.nwx") projFile = path.join(nwTempProj, "nwProject.nwx")
assert theProject.openProject(projFile) assert theProject.openProject(projFile)
theIndex = NWIndex(theProject, theMain) theIndex = NWIndex(theProject, theMain)
nHandle = "0e17daca5f3e1" nHandle = "0e17daca5f3e1"
nItem = theProject.projTree[nHandle]
cHandle = "02d20bbd7e394" cHandle = "02d20bbd7e394"
cItem = theProject.projTree[cHandle]
assert theIndex.scanText(cHandle, ( assert theIndex.scanText(cHandle, (
"# Jane Smith\n" "# Jane Smith\n"