Debian Codegraph @

tests/instruments/eurotest/test_eurotestHPP120256.py

raw
1 # Copyright (c) 2013-2024 PyMeasure Developers
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
12 #
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 # THE SOFTWARE.
20 #
21
22 from pymeasure.test import expected_protocol
23 from pymeasure.instruments.eurotest.eurotestHPP120256 import EurotestHPP120256
24
25
26 def test_voltage_setpoint():
27 """Verify the communication of the voltage setter/getter."""
28 with expected_protocol(
29 EurotestHPP120256,
30 [("U,1.200kV", None),
31 ("STATUS,U", "U, RANGE=3.000kV, VALUE=2.458kV")],
32 ) as inst:
33 inst.voltage_setpoint = 1.200
34 assert inst.voltage_setpoint == 2.458
35
36
37 def test_current_limit():
38 """Verify the communication of the current setter/getter."""
39 with expected_protocol(
40 EurotestHPP120256,
41 [("I,1.200mA", None),
42 ("STATUS,I", "I, RANGE=5000mA, VALUE=1739mA")],
43 ) as inst:
44 inst.current_limit = 1.200
45 assert inst.current_limit == 1739.0
46
47
48 def test_voltage_ramp():
49 """Verify the communication of the ramp setter/getter."""
50 with expected_protocol(
51 EurotestHPP120256,
52 [("RAMP,3000V/s", None),
53 ("STATUS,RAMP", "RAMP, RANGE=3000V/s, VALUE=1000V/s")],
54 ) as inst:
55 inst.voltage_ramp = 3000
56 assert inst.voltage_ramp == 1000.0
57
58
59 def test_voltage():
60 """Verify the communication of the measure_voltage getter."""
61 with expected_protocol(
62 EurotestHPP120256,
63 [("STATUS,MU", "UM, RANGE=3000V, VALUE=2.458kV")],
64 ) as inst:
65 assert inst.voltage == 2.458
66
67
68 def test_current():
69 """Verify the communication of the measure_current getter."""
70 with expected_protocol(
71 EurotestHPP120256,
72 [("STATUS,MI", "IM, RANGE=5000mA, VALUE=1739mA")],
73 ) as inst:
74 assert inst.current == 1739.0