Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pyfaradaycup/decommutator/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Most of these can be tested with `monkeypatch`, without new data files.

### Command line options

- [ ] **Test the usage errors from `pfc_decommutator`**: an `--apid` that is not hexadecimal and `--stcorrect`.
- [ ] **Test that `--stcorrect` raises an error**, unless it is removed first.

### Comparing CDF files

Expand Down
12 changes: 12 additions & 0 deletions tests/decommutator/test_decommutator.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@ def test_pfc_decommutator_l0file_option_removed(tmp_path: Path) -> None:
assert not list(tmp_path.glob("*.log"))


@pytest.mark.parametrize("apid", ["352x", "xyz", "", "0x", "3.5"])
def test_pfc_decommutator_apid_not_hexadecimal(tmp_path: Path, apid: str) -> None:
"""Test that an --apid that is not hexadecimal is a usage error."""
result = CliRunner().invoke(
pfc_decommutator,
[f"--l05dir={tmp_path}", f"--logdir={tmp_path}", f"--apid={apid}", str(l0file)],
)
assert result.exit_code == click.UsageError.exit_code
assert "is not a hexadecimal integer" in result.output
assert not list(tmp_path.iterdir())


def test_warn_about_ineffective_options(caplog: pytest.LogCaptureFixture) -> None:
"""Test that options with no effect are logged as warnings."""
with caplog.at_level(logging.WARNING, logger="pyfaradaycup"):
Expand Down