From 7c4f09cbb30e74c89a9edce994c3fc0a9f27517d Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Fri, 19 Jun 2026 22:54:05 -0600 Subject: [PATCH] Test RawFile.resolve_index -- exact match, case-insensitivity, no partial Locks in the exact-match semantics that distinguish resolve_index from get_variable, so the lookup used by tune_circuit and plot_waveform is now covered without needing the live LTspice path. --- tests/test_raw_parser.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_raw_parser.py b/tests/test_raw_parser.py index 9a42bef..db8d45b 100644 --- a/tests/test_raw_parser.py +++ b/tests/test_raw_parser.py @@ -69,6 +69,22 @@ class TestRawFileGetVariable: assert len(result) == mock_rawfile.points +class TestRawFileResolveIndex: + def test_exact_match_returns_index(self, mock_rawfile): + assert mock_rawfile.resolve_index("V(out)") == 1 + assert mock_rawfile.resolve_index("time") == 0 + + def test_case_insensitive(self, mock_rawfile): + assert mock_rawfile.resolve_index("v(out)") == 1 + + def test_partial_does_not_match(self, mock_rawfile): + """Unlike get_variable, resolve_index requires an exact name match.""" + assert mock_rawfile.resolve_index("out") is None + + def test_missing_returns_none(self, mock_rawfile): + assert mock_rawfile.resolve_index("V(nonexistent)") is None + + class TestRawFileRunData: def test_get_run_data_slicing(self, mock_rawfile_stepped): """Extracting a single run produces correct point count."""