| 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 |
from pymeasure.instruments.kepco import KepcoBOP3612 |
| 27 |
|
| 28 |
|
| 29 |
def test_init(): |
| 30 |
with expected_protocol( |
| 31 |
KepcoBOP3612, |
| 32 |
[], |
| 33 |
): |
| 34 |
pass # Verify the expected communication. |
| 35 |
|
| 36 |
|
| 37 |
def test_bop_test_getter(): |
| 38 |
with expected_protocol( |
| 39 |
KepcoBOP3612, |
| 40 |
[(b'DIAG:TST?', b'0')], |
| 41 |
) as inst: |
| 42 |
assert inst.bop_test == 0 |
| 43 |
|
| 44 |
|
| 45 |
def test_confidence_test_getter(): |
| 46 |
with expected_protocol( |
| 47 |
KepcoBOP3612, |
| 48 |
[(b'*TST?', b'0')], |
| 49 |
) as inst: |
| 50 |
assert inst.confidence_test == 0 |
| 51 |
|
| 52 |
|
| 53 |
def test_current_getter(): |
| 54 |
with expected_protocol( |
| 55 |
KepcoBOP3612, |
| 56 |
[(b'MEASure:CURRent?', b'4.99E-3')], |
| 57 |
) as inst: |
| 58 |
assert inst.current == 0.00499 |
| 59 |
|
| 60 |
|
| 61 |
def test_current_setpoint_setter(): |
| 62 |
with expected_protocol( |
| 63 |
KepcoBOP3612, |
| 64 |
[(b'CURRent 0.1', None)], |
| 65 |
) as inst: |
| 66 |
inst.current_setpoint = 0.1 |
| 67 |
|
| 68 |
|
| 69 |
def test_current_setpoint_getter(): |
| 70 |
with expected_protocol( |
| 71 |
KepcoBOP3612, |
| 72 |
[(b'CURRent?', b'9.989E-2')], |
| 73 |
) as inst: |
| 74 |
assert inst.current_setpoint == 0.09989 |
| 75 |
|
| 76 |
|
| 77 |
def test_id_getter(): |
| 78 |
with expected_protocol( |
| 79 |
KepcoBOP3612, |
| 80 |
[(b'*IDN?', b'KEPCO,BIT 4886 36-12 08-04-2023,H249977,4.04-1.82')], |
| 81 |
) as inst: |
| 82 |
assert inst.id == 'KEPCO,BIT 4886 36-12 08-04-2023,H249977,4.04-1.82' |
| 83 |
|
| 84 |
|
| 85 |
def test_output_enabled_getter(): |
| 86 |
with expected_protocol( |
| 87 |
KepcoBOP3612, |
| 88 |
[(b'OUTPut?', b'0')], |
| 89 |
) as inst: |
| 90 |
assert inst.output_enabled is False |
| 91 |
|
| 92 |
|
| 93 |
def test_voltage_getter(): |
| 94 |
with expected_protocol( |
| 95 |
KepcoBOP3612, |
| 96 |
[(b'MEASure:VOLTage?', b'8.0E-3')], |
| 97 |
) as inst: |
| 98 |
assert inst.voltage == 0.008 |
| 99 |
|
| 100 |
|
| 101 |
def test_voltage_setpoint_setter(): |
| 102 |
with expected_protocol( |
| 103 |
KepcoBOP3612, |
| 104 |
[(b'VOLTage 0.1', None)], |
| 105 |
) as inst: |
| 106 |
inst.voltage_setpoint = 0.1 |
| 107 |
|
| 108 |
|
| 109 |
def test_voltage_setpoint_getter(): |
| 110 |
with expected_protocol( |
| 111 |
KepcoBOP3612, |
| 112 |
[(b'VOLTage?', b'1.000E-1')], |
| 113 |
) as inst: |
| 114 |
assert inst.voltage_setpoint == 0.1 |
| 115 |
|
| 116 |
|
| 117 |
def test_beep(): |
| 118 |
with expected_protocol( |
| 119 |
KepcoBOP3612, |
| 120 |
[(b'SYSTem:BEEP', None)], |
| 121 |
) as inst: |
| 122 |
assert inst.beep() is None |