Debian Codegraph @

tests/instruments/lakeshore/test_lakeshore425.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 from pymeasure.test import expected_protocol
26
27 from pymeasure.instruments.lakeshore import LakeShore425
28
29
30 def test_init():
31 with expected_protocol(
32 LakeShore425, []):
33 pass # Verify the expected communication.
34
35
36 def test_unit():
37 # from manual
38 with expected_protocol(
39 LakeShore425, [(b"UNIT?", b"1")]) as instr:
40 assert instr.unit == "G"
41
42
43 def test_unit_setter():
44 # from manual
45 with expected_protocol(
46 LakeShore425, [(b"UNIT 2", None)]) as instr:
47 instr.unit = "T"
48
49
50 def test_field():
51 # from manual
52 with expected_protocol(
53 LakeShore425,
54 [(b"RDGFIELD?", b"+123.456E-01")]
55 ) as instr:
56 assert instr.field == 123.456e-1
57
58
59 def test_zero_probe():
60 # from manual
61 with expected_protocol(
62 LakeShore425, [(b"ZPROBE", None)]) as instr:
63 instr.zero_probe()