diff options
Diffstat (limited to 'lab_control/test')
-rw-r--r-- | lab_control/test/frequency_response_test.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lab_control/test/frequency_response_test.py b/lab_control/test/frequency_response_test.py index 014b4f6..ad47d53 100644 --- a/lab_control/test/frequency_response_test.py +++ b/lab_control/test/frequency_response_test.py @@ -37,7 +37,7 @@ def test_frequencyResponseDefaults(uut): assert uut.functionGeneratorChannel == 1 assert uut.oscilloscopeChannel == 1 -def test_frequencyResponseRamp(mockLab, uut): +def test_frequencyResponseRamp(uut, mockLab): uut.minFrequency = 100.0 uut.maxFrequency = 200.0 uut.steps = 11 @@ -49,8 +49,23 @@ def test_frequencyResponseRamp(mockLab, uut): assert not uut.measurementDone assert uut.data == None - response = uut.measure(mockLab, mockLab) + uut.measure(mockLab, mockLab) assert uut.measurementDone assert uut.data == expectedData +def test_dumpToCSV(uut, mockLab, tmp_path): + uut.minFrequency = 10.0 + uut.maxFrequency = 30.0 + uut.steps = 5 + + expectedData = prepareRampResponse(uut, mockLab) + uut.measure(mockLab, mockLab) + + csv = tmp_path / "data.csv" + uut.dumpToCSV(csv) + savedData = csv.read_text().split("\n") + + assert savedData[0] == "Frequency (Hz),Amplitude (V)" + for i, l in enumerate(savedData[1:]): + assert l == f"{expectedData[i][0]},{expectedData[i][1]}" |