| 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 |
|
| 28 |
from pymeasure.instruments.oxfordinstruments.ips120_10 import IPS120_10 |
| 29 |
|
| 30 |
|
| 31 |
def test_version(): |
| 32 |
with expected_protocol(IPS120_10, |
| 33 |
[("V", "IPS120-10 Version 3.04 @ Oxford Instruments 1996")] |
| 34 |
) as inst: |
| 35 |
assert inst.version == "IPS120-10 Version 3.04 @ Oxford Instruments 1996" |
| 36 |
|
| 37 |
|
| 38 |
def test_activity_getter(): |
| 39 |
with expected_protocol(IPS120_10, |
| 40 |
[("X", "X00A0C0M00P00")] |
| 41 |
) as inst: |
| 42 |
assert inst.activity == "hold" |
| 43 |
|
| 44 |
|
| 45 |
def test_activity_setter(): |
| 46 |
with expected_protocol(IPS120_10, |
| 47 |
[("A0", "A")] |
| 48 |
) as inst: |
| 49 |
inst.activity = "hold" |
| 50 |
|
| 51 |
|
| 52 |
def test_current_setpoint_getter(): |
| 53 |
with expected_protocol(IPS120_10, |
| 54 |
[("R0", "R+1.3")] |
| 55 |
) as inst: |
| 56 |
assert inst.current_setpoint == 1.3 |
| 57 |
|
| 58 |
|
| 59 |
def test_current_setpoint_setter(): |
| 60 |
with expected_protocol(IPS120_10, |
| 61 |
[("I1.300000", "I")] |
| 62 |
) as inst: |
| 63 |
inst.current_setpoint = 1.3 |
| 64 |
|
| 65 |
|
| 66 |
def test_control_mode_getter(): |
| 67 |
with expected_protocol(IPS120_10, |
| 68 |
[("X", "X00A0C1M00P00")] |
| 69 |
) as inst: |
| 70 |
assert inst.control_mode == "RL" |
| 71 |
|
| 72 |
|
| 73 |
def test_control_mode_setter(): |
| 74 |
with expected_protocol(IPS120_10, |
| 75 |
[("C1", "C")] |
| 76 |
) as inst: |
| 77 |
inst.control_mode = "RL" |