diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5a34bea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[tool.pytest.ini_options] +pythonpath = [ + "." +] diff --git a/scripts/tests/test_distill.py b/scripts/tests/test_distill.py index 7f3a3d1..ecb52c8 100644 --- a/scripts/tests/test_distill.py +++ b/scripts/tests/test_distill.py @@ -5,7 +5,7 @@ # Add the scripts directory to sys.path to allow importing distill sys.path.append(str(pathlib.Path(__file__).parent.parent)) -from distill import clean_signal +from distill import clean_signal, is_durable_signal @pytest.mark.parametrize("input_line, expected", [ # Basic cases @@ -49,3 +49,44 @@ ]) def test_clean_signal(input_line, expected): assert clean_signal(input_line) == expected + + +@pytest.mark.parametrize( + "line,expected", + [ + # Empty + ("", False), + + # Length < 12 + ("short", False), + ("12345678901", False), + + # Starts with # or > [! + ("# A heading that is long enough", False), + ("> [!info] Some info", False), + ("> [!warning] warning", False), + + # NOISE_RE matches + ("ok ", False), + ("okay.", False), + ("yes!", False), + ("understood!!!", False), + + # SHELL_NOISE_RE matches + ("$ python3 script.py", False), + ("Running test: xyz", False), + ("Traceback (most recent call last):", False), + ("Exception: Something went wrong", False), + ("FAIL: test_something", False), + ("error: must read the pane correctly", False), + ("[tmux-bridge error]", False), + + # Valid durable signals (Happy paths) + ("123456789012", True), + ("We decided to keep distill.py dry-run and let Claude own writes.", True), + ("This is a valid durable signal that should be captured.", True), + ("Next action: implement tests for distill.py.", True), + ] +) +def test_is_durable_signal(line, expected): + assert is_durable_signal(line) is expected