Debian Codegraph @

tests/instruments/tdk/test_tdk_base.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 from pymeasure.test import expected_protocol
25 from pymeasure.instruments.tdk.tdk_base import TDK_Lambda_Base
26
27
28 def test_init():
29 with expected_protocol(
30 TDK_Lambda_Base,
31 [(b"ADR 6", b"OK")],
32 ):
33 pass # Verify the expected communication.
34
35
36 def test_identity():
37 with expected_protocol(
38 TDK_Lambda_Base,
39 [(b"ADR 6", b"OK"),
40 (b"IDN?", b'LAMBDA,GENX-Y'),
41 (b"REV?", b"REV:1U:4.3")]
42 ) as instr:
43 assert instr.id == ["LAMBDA", "GENX-Y"]
44 assert instr.version == "REV:1U:4.3"
45
46
47 def test_multidrop_capability():
48 with expected_protocol(
49 TDK_Lambda_Base,
50 [(b"ADR 6", b"OK"),
51 (b"MDAV?", b'1')]
52 ) as instr:
53 assert instr.multidrop_capability is True
54
55
56 def test_remote():
57 with expected_protocol(
58 TDK_Lambda_Base,
59 [(b"ADR 6", b"OK"),
60 (b"RMT?", b"REM"),
61 (b"RMT LOC", b"OK"),
62 (b"RMT?", b"LOC"), ]
63 ) as instr:
64 assert instr.remote == "REM"
65 instr.remote = 'LOC'
66 assert instr.remote == "LOC"