Skip to content

Commit d8d3abe

Browse files
chrisdpurcellclaude
andcommitted
test: fix pre-populated fileNameEdit in handler tests and use APP_VERSION constant
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0f01185 commit d8d3abe

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/integration/test_main_window.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import pytest
66

7+
from src.utils.constants import APP_VERSION
8+
79
from src.models.cleaning_options import CleaningOptions
810
from src.models.text_document import TextDocument
911
from src.viewmodels.main_viewmodel import MainViewModel
@@ -270,9 +272,9 @@ def test_file_click_loads_file(self, window, tmp_path, qtbot):
270272
f = tmp_path / "click.txt"
271273
f.write_text("click content", encoding="utf-8")
272274
window._fs_model.filePath = MagicMock(return_value=str(f))
273-
window._file_name_edit.setText(str(f))
274275
with qtbot.waitSignal(window._viewmodel.document_loaded, timeout=1000):
275276
window._on_tree_item_clicked(MagicMock())
277+
assert window._file_name_edit.text() == str(f) # confirms line 233 ran
276278

277279
def test_directory_click_is_ignored(self, window, tmp_path):
278280
"""Clicking a directory does not call load_file — line 232 branch."""
@@ -292,10 +294,9 @@ def test_chosen_file_is_loaded(self, window, tmp_path, monkeypatch, qtbot):
292294
"src.views.main_window.QFileDialog.getOpenFileName",
293295
lambda *a, **kw: (str(f), ""),
294296
)
295-
window._file_name_edit.setText(str(f))
296297
with qtbot.waitSignal(window._viewmodel.document_loaded, timeout=1000):
297298
window._on_action_open()
298-
assert window._file_name_edit.text() == str(f)
299+
assert window._file_name_edit.text() == str(f) # confirms line 305 ran
299300

300301
def test_cancelled_dialog_is_no_op(self, window, monkeypatch):
301302
"""QFileDialog returns '' → nothing happens — lines 303-304 branch."""
@@ -319,7 +320,7 @@ def test_about_dialog_is_shown(self, window, monkeypatch):
319320
)
320321
window._on_action_about()
321322
assert len(calls) == 1
322-
assert "0.2.0" in calls[0][2]
323+
assert APP_VERSION in calls[0][2]
323324

324325

325326
class TestErrorHandler:

0 commit comments

Comments
 (0)