Fix warnings in tests

This commit is contained in:
Veronica Berglyd Olsen
2025-01-13 19:43:04 +01:00
parent 72ed5d84f6
commit 0b7c31b6a9
11 changed files with 336 additions and 102 deletions
+6 -2
View File
@@ -95,7 +95,9 @@ def testToolManuscriptBuild_Main(
assert (fncPath / "TestBuild").with_suffix(nwLabels.BUILD_EXT[fmt]).exists()
lastFmt = fmt
manus._dialogButtonClicked(manus.buttonBox.button(QtDialogClose))
button = manus.buttonBox.button(QtDialogClose)
assert button is not None
manus._dialogButtonClicked(button)
manus.deleteLater()
assert build.lastBuildName == "TestBuild"
@@ -150,5 +152,7 @@ def testToolManuscriptBuild_Main(
assert lastUrl.startswith("file://")
# Finish
manus._dialogButtonClicked(manus.buttonBox.button(QtDialogClose))
button = manus.buttonBox.button(QtDialogClose)
assert button is not None
manus._dialogButtonClicked(button)
# qtbot.stop()
+15 -5
View File
@@ -67,7 +67,9 @@ def testToolManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
# Build a preview
manus.buildList.clearSelection()
manus.buildList.setCurrentRow(0)
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
document = manus.docPreview.document()
assert document is not None
with qtbot.waitSignal(document.contentsChanged):
manus.btnPreview.click()
assert manus.docPreview.toPlainText().strip() == allText
@@ -113,7 +115,9 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings.buttonBox.button(QtDialogSave).click()
button = bSettings.buttonBox.button(QtDialogSave)
assert button is not None
button.click()
assert isinstance(build, BuildSettings)
assert build.name == "Test Build"
@@ -132,7 +136,9 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings.buttonBox.button(QtDialogApply).click() # Should leave the dialog open
button = bSettings.buttonBox.button(QtDialogApply)
assert button is not None
button.click() # Should leave the dialog open
assert isinstance(build, BuildSettings)
assert build.name == "Test Build"
@@ -210,7 +216,9 @@ def testToolManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
manus._builds.setBuild(build)
manus.buildList.setCurrentRow(0)
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
document = manus.docPreview.document()
assert document is not None
with qtbot.waitSignal(document.contentsChanged):
manus.btnPreview.click()
assert manus.docPreview.toPlainText().strip() != ""
@@ -304,7 +312,9 @@ def testToolManuscript_Print(monkeypatch, qtbot, nwGUI, projPath):
manus.loadContent()
manus.buildList.setCurrentRow(0)
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
document = manus.docPreview.document()
assert document is not None
with qtbot.waitSignal(document.contentsChanged):
manus.btnPreview.click()
assert manus.docPreview.toPlainText().strip() != ""
+60 -20
View File
@@ -51,13 +51,19 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
bSettings.loadContent()
# Flip through pages
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1)
assert button is not None
button.click()
assert isinstance(bSettings.toolStack.currentWidget(), _FormattingTab)
bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
button = bSettings.sidebar._group.button(bSettings.OPT_HEADINGS)
assert button is not None
button.click()
assert isinstance(bSettings.toolStack.currentWidget(), _HeadingsTab)
bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FILTERS)
assert button is not None
button.click()
assert isinstance(bSettings.toolStack.currentWidget(), _FilterTab)
# Check dialog buttons
@@ -72,7 +78,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
# Capture Apply button
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogApply))
button = bSettings.buttonBox.button(QtDialogApply)
assert button is not None
bSettings._dialogButtonClicked(button)
assert triggered
@@ -81,7 +89,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogSave))
button = bSettings.buttonBox.button(QtDialogSave)
assert button is not None
bSettings._dialogButtonClicked(button)
assert triggered
@@ -98,7 +108,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
assert triggered
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -129,7 +141,9 @@ def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
bSettings.loadContent()
filterTab = bSettings.optTabSelect
bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FILTERS)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is filterTab
# Check content
@@ -308,7 +322,9 @@ def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
]
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -339,7 +355,9 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
bSettings.loadContent()
headTab = bSettings.optTabHeadings
bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
button = bSettings.sidebar._group.button(bSettings.OPT_HEADINGS)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is headTab
# Check initial values
@@ -478,7 +496,9 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
assert build.getBool("headings.hideSection") is True
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -501,7 +521,9 @@ def testToolBuildSettings_FormatTextContent(qtbot, nwGUI):
bSettings.loadContent()
fmtTab = bSettings.optTabFormatting
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values
@@ -538,7 +560,9 @@ def testToolBuildSettings_FormatTextContent(qtbot, nwGUI):
assert build.getBool("text.addNoteHeadings") is True
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -563,7 +587,9 @@ def testToolBuildSettings_FormatTextFormat(monkeypatch, qtbot, nwGUI):
bSettings.loadContent()
fmtTab = bSettings.optTabFormatting
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 2).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 2)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values
@@ -610,7 +636,9 @@ def testToolBuildSettings_FormatTextFormat(monkeypatch, qtbot, nwGUI):
assert fmtTab._textFont == font
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -629,7 +657,9 @@ def testToolBuildSettings_FormatFirstLineIndent(monkeypatch, qtbot, nwGUI):
bSettings.loadContent()
fmtTab = bSettings.optTabFormatting
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 3).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 3)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values
@@ -650,7 +680,9 @@ def testToolBuildSettings_FormatFirstLineIndent(monkeypatch, qtbot, nwGUI):
assert build.getBool("format.indentFirstPar") is True
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -674,7 +706,9 @@ def testToolBuildSettings_FormatPageLayout(monkeypatch, qtbot, nwGUI):
bSettings.loadContent()
fmtTab = bSettings.optTabFormatting
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 4).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 4)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values
@@ -704,7 +738,9 @@ def testToolBuildSettings_FormatPageLayout(monkeypatch, qtbot, nwGUI):
assert fmtTab.rightMargin.value() == 1.5
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
@@ -728,7 +764,9 @@ def testToolBuildSettings_FormatOutput(qtbot, nwGUI):
bSettings.loadContent()
fmtTab = bSettings.optTabFormatting
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 5).click()
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 5)
assert button is not None
button.click()
assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values
@@ -769,5 +807,7 @@ def testToolBuildSettings_FormatOutput(qtbot, nwGUI):
assert fmtTab.odtPageHeader.text() == nwHeadFmt.DOC_AUTO
# Finish
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
button = bSettings.buttonBox.button(QtDialogClose)
assert button is not None
bSettings._dialogButtonClicked(button)
# qtbot.stop()
+217 -56
View File
@@ -125,14 +125,37 @@ def testToolWritingStats_Export(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
assert sessLog.notesWords.text() == "{:n}".format(275)
assert sessLog.totalWords.text() == "{:n}".format(875)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(300)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-120)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-20)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(40)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-400)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(200)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
assert sessLog._saveData(sessLog.FMT_CSV)
assert sessLog._saveData(sessLog.FMT_JSON)
@@ -205,14 +228,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
sessLog.populateGUI()
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(300)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-120)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-20)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(40)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-400)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(200)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
# No Novel Files
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
@@ -222,14 +268,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
jsonData = json.loads(inFile.read())
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-100)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(150)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-60)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-10)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(20)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(100)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-100)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(150)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-60)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-10)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(20)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(100)
assert jsonData == [
{
@@ -268,14 +337,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
jsonData = json.load(inFile)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-100)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(150)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-60)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-10)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(20)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(100)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-100)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(150)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-60)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-10)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(20)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(100)
assert jsonData == [
{
@@ -314,10 +406,21 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
jsonData = json.load(inFile)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(300)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(40)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(200)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
assert jsonData == [
{
@@ -344,16 +447,45 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
jsonData = json.load(inFile)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(0)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(300)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-120)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(-20)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(40)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(-400)
assert sessLog.listBox.topLevelItem(8).text(sessLog.C_COUNT) == "{:n}".format(200)
assert sessLog.listBox.topLevelItem(9).text(sessLog.C_COUNT) == "{:n}".format(0)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
item = sessLog.listBox.topLevelItem(8)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
item = sessLog.listBox.topLevelItem(9)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
assert jsonData == [
{
@@ -390,9 +522,15 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
]
# Toggle Idle Time
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_IDLE) == "4 %"
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_IDLE) == "4 %"
qtbot.mouseClick(sessLog.showIdleTime, QtMouseLeft)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_IDLE) == "00:01:10"
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_IDLE) == "00:01:10"
# Group by Day
qtbot.mouseClick(sessLog.groupByDay, QtMouseLeft)
@@ -402,14 +540,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
jsonData = json.load(inFile)
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(180)
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-20)
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(40)
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(-400)
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(200)
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(0)
item = sessLog.listBox.topLevelItem(0)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
item = sessLog.listBox.topLevelItem(1)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
item = sessLog.listBox.topLevelItem(2)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(180)
item = sessLog.listBox.topLevelItem(3)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
item = sessLog.listBox.topLevelItem(4)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
item = sessLog.listBox.topLevelItem(5)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
item = sessLog.listBox.topLevelItem(6)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
item = sessLog.listBox.topLevelItem(7)
assert item is not None
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
assert jsonData == [
{