summaryrefslogtreecommitdiffstats
path: root/lab_control/test
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-06-05 11:34:50 +0200
committerEddy Pedroni <eddy@0xf7.com>2022-06-05 11:34:50 +0200
commit1393405ed5e8796a37224344c51cdcd4427f9b4b (patch)
tree9a9b2f1aaf5eeb699f57e2ee050d88c60e032edf /lab_control/test
parent586478f487ad03f0774f8f50bc40c6c029b6176d (diff)
Minor improvement to automatic vertical scaling
Diffstat (limited to 'lab_control/test')
-rw-r--r--lab_control/test/frequency_response_test.py6
-rw-r--r--lab_control/test/mock_lab.py3
2 files changed, 6 insertions, 3 deletions
diff --git a/lab_control/test/frequency_response_test.py b/lab_control/test/frequency_response_test.py
index 61fd021..d694887 100644
--- a/lab_control/test/frequency_response_test.py
+++ b/lab_control/test/frequency_response_test.py
@@ -49,19 +49,19 @@ def test_frequencyResponseRamp(uut, mockLab):
expectedData = prepareRampResponse(uut, mockLab)
- assert not uut.measurementDone
- assert uut.data is None
assert fg.amplitude is None
assert fg.function is None
assert not fg.on
assert osc.voltsPerDiv is None
+ assert not uut.measurementDone
+ assert uut.data is None
uut.measure(mockLab, mockLab)
assert fg.amplitude == uut.inputAmplitude
assert fg.function == FunctionGenerator.SINE
assert fg.on
- assert osc.voltsPerDiv == uut.inputAmplitude / 6
+ assert osc.voltsPerDiv == uut.inputAmplitude / (mockLab.getDivisionsDisplayed() - 2)
assert uut.measurementDone
assert uut.data == expectedData
diff --git a/lab_control/test/mock_lab.py b/lab_control/test/mock_lab.py
index 75ba1bf..1016b92 100644
--- a/lab_control/test/mock_lab.py
+++ b/lab_control/test/mock_lab.py
@@ -55,6 +55,9 @@ class MockLab(FunctionGenerator, Oscilloscope):
def setVoltsPerDivision(self, channel: int, volts: float) -> None:
self.oscChannels[channel - 1].voltsPerDiv = volts
+ def getDivisionsDisplayed(self) -> int:
+ return 12
+
def setTestFunction(self, channel: int, f: Callable[[float], float]) -> None:
self.oscChannels[channel - 1].testFunction = f