Skip to content

Commit 76370b5

Browse files
mnriemCopilot
andcommitted
test: use single DOTALL regex to verify assignment flows into Live()
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b114287 commit 76370b5

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/test_live_transient_windows.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,25 @@ def test_transient_true_on_macos(self):
6666

6767

6868
class TestSourceContainsPlatformGuard:
69-
"""Ensure the platform guard and its usage in Live() are present in source."""
69+
"""Ensure the platform guard feeds into the Live() transient kwarg."""
70+
71+
# Single DOTALL regex: _transient assigned from win32 check, then used in Live()
72+
_GUARD_RE = r"_transient\s*=\s*sys\.platform\s*!=\s*['\"]win32['\"].*Live\(.*transient\s*=\s*_transient"
7073

7174
def test_init_has_win32_guard(self):
72-
"""init.py must check platform and pass transient to Live."""
75+
"""init.py must assign _transient from platform check and pass it to Live."""
7376
import re
7477

7578
init_src = Path(__file__).resolve().parent.parent / "src" / "specify_cli" / "commands" / "init.py"
7679
content = init_src.read_text(encoding="utf-8")
77-
assert re.search(r"sys\.platform\s*!=\s*['\"]win32['\"]", content)
78-
assert re.search(r"transient\s*=\s*_transient", content)
80+
assert re.search(self._GUARD_RE, content, re.DOTALL)
7981

8082
def test_console_has_win32_guard(self):
81-
"""_console.py must check platform and pass transient to Live."""
83+
"""_console.py must assign _transient from platform check and pass it to Live."""
8284
import re
8385

8486
console_src = Path(__file__).resolve().parent.parent / "src" / "specify_cli" / "_console.py"
8587
content = console_src.read_text(encoding="utf-8")
86-
assert re.search(r"sys\.platform\s*!=\s*['\"]win32['\"]", content)
88+
assert re.search(self._GUARD_RE, content, re.DOTALL)
8789
assert re.search(r"transient\s*=\s*_transient", content)
8890
assert "transient=_transient" in content

0 commit comments

Comments
 (0)