from pymeasure.test import expected_protocol from pymeasure.instruments.hp import HP3478A def test_init(): with expected_protocol( HP3478A, [] ): pass # Verify the expected communication. def test_active_connectors(): with expected_protocol( HP3478A, [(b'B', b'-\x1f\x00\x00$')] ) as instr: assert instr.active_connectors == 'front' def test_auto_range_enabled(): with expected_protocol( HP3478A, [(b'B', b'-\x1f\x00\x00$')] ) as instr: assert instr.auto_range_enabled == True def test_auto_zero_enabled(): with expected_protocol( HP3478A, [(b'B', b'-\x1f\x00\x00$')] ) as instr: assert instr.auto_zero_enabled == True def test_auto_zero_enabled_setter(): with expected_protocol( HP3478A, [(b'Z1', None)] ) as instr: instr.auto_zero_enabled = True def test_auto_zero_enabled_setter(): with expected_protocol( HP3478A, [(b'Z0', None)] ) as instr: instr.auto_zero_enabled = False def test_calibration_enabled(): with expected_protocol( HP3478A, [(b'B', b'-\x1b\x00\x00$')] ) as instr: assert instr.calibration_enabled == False def test_check_errors(): with expected_protocol( HP3478A, [(b'E', b'00\r')] ) as instr: assert instr.check_errors() == 0 def test_display_reset(): with expected_protocol( HP3478A, [(b'D1', None)] ) as instr: assert instr.display_reset() == None def test_mode(): with expected_protocol( HP3478A, [(b'B', b'-\x1b\x00\x00$')] ) as instr: assert instr.mode == 'DCV' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F6', None)] ) as instr: instr.mode = 'ACI' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F2', None)] ) as instr: instr.mode = 'ACV' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F5', None)] ) as instr: instr.mode = 'DCI' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F1', None)] ) as instr: instr.mode = 'DCV' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F3', None)] ) as instr: instr.mode = 'R2W' def test_mode_setter(): with expected_protocol( HP3478A, [(b'F4', None)] ) as instr: instr.mode = 'R4W' def test_range(): with expected_protocol( HP3478A, [(b'B', b'\x85\x1b\x00\x00$'), (b'B', b'\x85\x1b\x00\x00$')] ) as instr: assert instr.range == 30.0 def test_resolution(): with expected_protocol( HP3478A, [(b'B', b'\x85\x1b\x00\x00$')] ) as instr: assert instr.resolution == 5 def test_resolution_setter(): with expected_protocol( HP3478A, [(b'N3', None)] ) as instr: instr.resolution = 3 def test_resolution_setter(): with expected_protocol( HP3478A, [(b'N4', None)] ) as instr: instr.resolution = 4 def test_resolution_setter(): with expected_protocol( HP3478A, [(b'N5', None)] ) as instr: instr.resolution = 5 def test_trigger(): with expected_protocol( HP3478A, [(b'B', b'\x85\x1b\x00\x00$')] ) as instr: assert instr.trigger == 'internal' def test_trigger_setter(): with expected_protocol( HP3478A, [(b'T1', None)] ) as instr: instr.trigger = 'internal' def test_trigger_setter(): with expected_protocol( HP3478A, [(b'T2', None)] ) as instr: instr.trigger = 'external' def test_trigger_setter(): with expected_protocol( HP3478A, [(b'T4', None)] ) as instr: instr.trigger = 'hold' def test_trigger_setter(): with expected_protocol( HP3478A, [(b'T5', None)] ) as instr: instr.trigger = 'fast'