Refactor: rename SimDUT, restructure DUT simulation and test flow
This commit is contained in:
20
tests/test_power_supply.py
Normal file
20
tests/test_power_supply.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# tests/test_power_supply.py
|
||||
"""
|
||||
Basic functional tests for the PowerSupply
|
||||
"""
|
||||
|
||||
def test_set_and_measure_voltage(power_supply):
|
||||
test_voltage = 5.0
|
||||
power_supply.set_voltage(test_voltage)
|
||||
measured = power_supply.measure_voltage()
|
||||
assert abs(measured - test_voltage) < 0.05
|
||||
|
||||
def test_output_toggle(power_supply):
|
||||
power_supply.enable_output(True)
|
||||
# Only works for DummyBackend which keeps state
|
||||
if hasattr(power_supply.comm, "state"):
|
||||
assert power_supply.comm.state["OUTP"] is True
|
||||
|
||||
power_supply.enable_output(False)
|
||||
if hasattr(power_supply.comm, "state"):
|
||||
assert power_supply.comm.state["OUTP"] is False
|
||||
Reference in New Issue
Block a user