Debian Codegraph @

tests/instruments/hp/test_hp8657b.py

raw
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2024 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24
25
26 from pymeasure.test import expected_protocol
27
28 from pymeasure.instruments.hp import HP8657B
29
30
31 def test_frequency():
32 with expected_protocol(
33 HP8657B,
34 [(b"FR 1234567890 HZ", None),
35 (b"FR 12345678 HZ", None)],
36 ) as instr:
37 instr.frequency = 1.23456789e9
38 instr.frequency = 1.2345678e7
39
40
41 def test_level():
42 with expected_protocol(
43 HP8657B,
44 [(b"AP -123.4 DM", None)],
45 ) as instr:
46 instr.level = -123.4
47
48
49 def test_output():
50 with expected_protocol(
51 HP8657B,
52 [(b"R3", None),
53 (b"R2", None)],
54 ) as instr:
55 instr.output_enabled = True
56 instr.output_enabled = False