repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
pymeasure/pymeasure | import time
import pytest
from pymeasure.instruments.texio.texioPSW360L30 import TexioPSW360L30
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestTexioPSW360L30:
RESOURCE = "TCPIP::192.168.10.119::2268::SOCKET"
INSTR = TexioPSW360L30(RESOURCE)
CURRENT_LIMIT = [0.1, 0.... | 0, abs=0.1) | pytest.approx | complex_expr | tests/instruments/texio/test_texioPSW360L30_with_device.py | test_everything_without_apply | TestTexioPSW360L30 | 82 | null |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.lakeshore.lakeshore211 import LakeShore211
def test_relays():
with expected_protocol(
LakeShore211,
[(b"RELAY? 1", b"0\r\n"),
(b"RELAY 1 2", None),
(b"RELAY? 1", b"2\r\n")
],
... | 2 | assert | numeric_literal | tests/instruments/lakeshore/test_lakeshore211.py | test_relays | 99 | null | |
pymeasure/pymeasure | import logging
from time import sleep
import numpy
import pytest
from pymeasure.adapters import PrologixAdapter
from pymeasure.instruments.hp import HP8753E
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
def hp8753e(connected_device_address):
try:
# This allows a PrologixAdapter... | 1 | assert | numeric_literal | tests/instruments/hp/test_hp8753e_with_device.py | test_hp8753e_with_device_averages | 286 | null | |
pymeasure/pymeasure | import pytest
import time
from pymeasure.instruments.siglenttechnologies import SDS1000XHD
def sds1000xhd(connected_device_address):
"""Fixture that provides a connected SDS1000XHD oscilloscope instance.
This fixture will be skipped if no device address is provided with the
--device-address command line a... | 10, abs=0.1) | pytest.approx | complex_expr | tests/instruments/siglenttechnologies/test_siglent_sds1000xhd_with_device.py | test_channel_settings | 88 | null | |
pymeasure/pymeasure | import logging
import pytest
from pymeasure.units import ureg
from pymeasure.test import expected_protocol
from pymeasure.instruments.common_base import DynamicProperty, CommonBase
from pymeasure.adapters import FakeAdapter, ProtocolAdapter
from pymeasure.instruments.validators import strict_discrete_set, strict_rang... | 0 | assert | numeric_literal | tests/instruments/test_common_base.py | test_control_process | 689 | null | |
pymeasure/pymeasure | import pytest
import pickle
from pymeasure.experiment.procedure import Procedure, ProcedureWrapper
from pymeasure.experiment.parameters import Parameter
from pymeasure.units import ureg
from data.procedure_for_testing import RandomProcedure
def test_parameters():
class TestProcedure(Procedure):
x = Param... | p.x | assert | complex_expr | tests/experiment/test_procedure.py | test_parameters | 46 | null | |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.aculight.argos import Argos, State
def test_seed_getter():
with expected_protocol(
Argos,
[("state",
" Crystal Temp Set = 55.000\n\r Etalon Angle Set = -0.020\n\r"
" Seed Source Set = 0.000\... | 0 | assert | numeric_literal | tests/instruments/aculight/test_argos.py | test_seed_getter | 98 | null | |
pymeasure/pymeasure | import time
from unittest import mock
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments import Instrument, Channel
from pymeasure.adapters import FakeAdapter, ProtocolAdapter
from pymeasure.instruments.fakes import FakeInstrument
from pymeasure.instruments.validators import truncat... | inst.f_X | assert | complex_expr | tests/instruments/test_instrument.py | test_functionality_dict | TestMultiFunctionality | 281 | null |
pymeasure/pymeasure | import math
import struct
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.siglenttechnologies import SDS1000XHD
def test_channel_unit_getter():
"""Test getting channel unit."""
with expected_protocol(
SDS1000XHD,
[(b':CHANnel1:UNIT?', b'V')],
... | 'V' | assert | string_literal | tests/instruments/siglenttechnologies/test_siglent_sds1000xhd.py | test_channel_unit_getter | 465 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentN8975A import AgilentN8975A
class TestAgilentN8975A:
def test_gain_scalar(self):
with expected_protocol(
AgilentN8975A,
[("FREQ:MODE?", "FIX"),
("FETCH:SCALAR:DATA:CORR... | inst.gain | assert | complex_expr | tests/instruments/agilent/test_agilentN8975A.py | test_gain_scalar | TestAgilentN8975A | 123 | null |
pymeasure/pymeasure | import pytest
import numpy as np
from pymeasure.instruments.keysight.keysightPNA import KeysightPNA
def keysightPNA_default(connected_device_address):
instr = KeysightPNA(connected_device_address)
return instr
def keysightPNA(connected_device_address):
instr = KeysightPNA(connected_device_address, timeout... | np.ndarray | assert | complex_expr | tests/instruments/keysight/test_keysightPNA_with_device.py | test_x_data | TestTrace | 129 | null |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley.keithley2306 import Keithley2306
def test_step():
with expected_protocol(
Keithley2306,
[(b":SENS:PCUR:STEP:TLEV3?", 4)],
) as instr:
step = instr.ch1.pulse_current_step(3)
assert ... | 4 | assert | numeric_literal | tests/instruments/keithley/test_keithley2306.py | test_step | 76 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D11_23",
"D13_23",
"D12_13",
... | bw | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_ch_IF_bandwidth | 154 | null | |
pymeasure/pymeasure | import numpy as np
import pytest
from pymeasure.experiment.parameters import Parameter
from pymeasure.experiment.parameters import IntegerParameter
from pymeasure.experiment.parameters import BooleanParameter
from pymeasure.experiment.parameters import FloatParameter
from pymeasure.experiment.parameters import ListPar... | 'V' | assert | string_literal | tests/experiment/test_parameters.py | test_integer_units | 46 | null | |
pymeasure/pymeasure | import pytest
import pickle
from pymeasure.experiment.procedure import Procedure, ProcedureWrapper
from pymeasure.experiment.parameters import Parameter
from pymeasure.units import ureg
from data.procedure_for_testing import RandomProcedure
def test_parameters():
class TestProcedure(Procedure):
x = Param... | 5 | assert | numeric_literal | tests/experiment/test_procedure.py | test_parameters | 40 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentB298x import AgilentB2987 # B2987 supports all features
from time import sleep
TEST_AMMETER = True
TEST_ELECTROMETER = True
TEST_TRIGGER = True
TEST_SOURCE = True
TEST_BATTERY = True
TRIGGER_LAYERS = ['acquisition', 'transient']
TRIGGER_SUB_SYSTEMS = ['arm', 't... | 0 | assert | numeric_literal | tests/instruments/agilent/test_agilentB298x_with_device.py | test_input_enabled | TestAmmeter | 80 | null |
pymeasure/pymeasure | import pytest
from pymeasure.errors import Error
from pymeasure.instruments.srs import LDC500Series
def ldc501(connected_device_address):
instr = LDC500Series(connected_device_address)
instr.reset()
instr.check_errors()
instr.ld.current_range = "LOW"
return instr
def test_tec_temperature_limits_n... | (25, 75) | assert | collection | tests/instruments/srs/test_ldc501_with_device.py | test_tec_temperature_limits_no_error | 61 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.anritsu import AnritsuMS464xB, AnritsuMS4642B, AnritsuMS4644B, \
AnritsuMS4645B, AnritsuMS4647B
def test_init_unknown_active_channels():
# Test init with unknown active channels and traces
with expected_protocol(
... | 8 | assert | numeric_literal | tests/instruments/anritsu/test_anritsuMS464xB.py | test_init_unknown_active_channels | 70 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.mksinst.mks974b import MKS974B, Unit
def test_status():
"""Verify the communication of the status."""
with expected_protocol(
MKS974B,
[("@253T?", "@253ACKO"),
(None, b"FF")],
) as inst:
... | "Ok" | assert | string_literal | tests/instruments/mksinst/test_mks974b.py | test_status | 47 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.hp.hp34401A import HP34401A
def test_range_dcv():
with expected_protocol(
HP34401A,
[
("FUNC \"VOLT\"", None),
("FUNC?", "VOLT"),
("VOLT:RANG?", "1"),
... | inst.range_ | assert | complex_expr | tests/instruments/hp/test_hp34401a.py | test_range_dcv | 56 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilent33500 import Agilent33500
from math import pi, sin
pytest.skip('Only works with connected hardware', allow_module_level=True)
def generator():
try:
generator = Agilent33500("TCPIP::192.168.225.208::inst0::INSTR")
except IOError:
print("No... | "" | assert | string_literal | tests/instruments/agilent/test_agilent33500_with_device.py | test_arb_file_should_not_be_empty | 258 | null | |
pymeasure/pymeasure | import numpy as np
import pytest
from pymeasure.experiment.parameters import Parameter
from pymeasure.experiment.parameters import IntegerParameter
from pymeasure.experiment.parameters import BooleanParameter
from pymeasure.experiment.parameters import FloatParameter
from pymeasure.experiment.parameters import ListPar... | 1 | assert | numeric_literal | tests/experiment/test_parameters.py | test_list_value | 151 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D11_23",
"D13_23",
"D12_13",
... | n | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_ch_averaging | 143 | null | |
pymeasure/pymeasure | import pytest
import serial
from pymeasure.adapters import SerialAdapter
def adapter():
return SerialAdapter(serial.serial_for_url("loop://", timeout=0.2))
@pytest.mark.parametrize("msg", ["OUTP\n", "POWER 22 dBm\n"])
def test_adapter_write_read(adapter, msg):
adapter.write(msg)
assert adapter.read() ==... | msg | assert | variable | tests/adapters/test_serial.py | test_adapter_write_read | 53 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley import KeithleyDMM6500
def test_check_errors():
with expected_protocol(
KeithleyDMM6500,
[(b'*LANG SCPI', None),
(b'SYST:ERR?', b'0,"No error;0;0 0"\n')],
) as inst:
ass... | [] | assert | collection | tests/instruments/keithley/test_keithleyDMM6500.py | test_check_errors | 750 | null | |
pymeasure/pymeasure | from unittest import mock
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments import Channel, Instrument
from pymeasure.instruments.validators import truncated_range
def test_channel_measurement():
with expected_protocol(
ChannelInstrument,
[("CA:measurem... | "Y" | assert | string_literal | tests/instruments/test_channel.py | test_channel_measurement | 176 | null | |
pymeasure/pymeasure | import logging
import pytest
from pymeasure.units import ureg
from pymeasure.test import expected_protocol
from pymeasure.instruments.common_base import DynamicProperty, CommonBase
from pymeasure.adapters import FakeAdapter, ProtocolAdapter
from pymeasure.instruments.validators import strict_discrete_set, strict_rang... | 3 | assert | numeric_literal | tests/instruments/test_common_base.py | test_channels | TestInitWithMultipleChannelCreator | 204 | null |
pymeasure/pymeasure | import pytest
import time
import logging
from pymeasure.instruments.hp.hp34401A import HP34401A
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
FUNCTIONS = ["DCV", "DCV_RATIO", "ACV", "DCI", "ACI", "R2W",
"R4W", "FREQ", "PERIOD", "CONTINUITY", "DIODE"]
FUNCTIONS_WITH_RANGE = ["DC... | 0 | assert | numeric_literal | tests/instruments/hp/test_hp34401a_with_device.py | test_given_function_when_set_then_function_is_set | 65 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.inficon.sqm160 import calculate_checksum, SQM160
def test_number_of_channels():
"""Verify the communication of the number of channels."""
with expected_protocol(
SQM160,
[(b"!#JO8", b"!%A6v\x86"), ],
... | 6 | assert | numeric_literal | tests/instruments/inficon/test_sqm160.py | test_number_of_channels | 52 | null | |
pymeasure/pymeasure | from time import sleep
from unittest.mock import ANY
import numpy as np
import pytest
from pyvisa.errors import VisaIOError
from pymeasure.instruments.lecroy.lecroyT3DSO1204 import LeCroyT3DSO1204
class TestLeCroyT3DSO1204:
BOOLEANS = [False, True]
CHANNEL_COUPLINGS = ["ac 1M", "dc 1M", "ground"]
ACQUIS... | 1 | assert | numeric_literal | tests/instruments/lecroy/test_lecroyT3DSO1204_with_device.py | test_ch_offset | TestLeCroyT3DSO1204 | 144 | null |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.spellmanhv.spellmanXRV import SpellmanXRV, StatusCode, ErrorCode
def spellman(connected_device_address):
instr = SpellmanXRV(connected_device_address)
instr.reset_errors()
return instr
class TestSpellmanXRV:
def test_scaling(self, spellman):
scaling = ... | [0, 1] | assert | collection | tests/instruments/spellmanhv/test_spellmanXRV_with_device.py | test_scaling | TestSpellmanXRV | 106 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilent33500 import Agilent33500
@pytest.mark.parametrize("phase", [-360, 360])
def test_phase(phase):
"""
Test Agilent 33500 phase function
"""
with expected_protocol(
Agilent33500,
[
... | inst.phase | assert | complex_expr | tests/instruments/agilent/test_agilent33500.py | test_phase | 242 | null | |
pymeasure/pymeasure | import pytest
import time
from pymeasure.instruments.aimtti import LD400P
def instrument(connected_device_address):
instr = LD400P(connected_device_address)
instr.reset()
return instr
def test_load(instrument):
"""
Connect the load to a power supply that delivers at least 1V and can supply 200mA
... | "C" | assert | string_literal | tests/instruments/aimtti/test_ld400p_with_device.py | test_load | 52 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.validators import (
strict_range, strict_discrete_range, strict_discrete_set,
truncated_range, truncated_discrete_set,
modular_range, modular_range_bidirectional,
joined_validators
)
def test_modular_range():
assert modular_range(5, range(10)) == 5
asser... | 2 | assert | numeric_literal | tests/instruments/test_validators.py | test_modular_range | 80 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D... | n | assert | variable | tests/instruments/agilent/test_agilentE5062A.py | test_ch_averaging | 227 | null | |
pymeasure/pymeasure | import os
import pickle
import tempfile
from unittest import mock
import pandas as pd
import pytest
import numpy as np
from pymeasure.units import ureg
from pymeasure.experiment.results import Results, CSVFormatter
from pymeasure.experiment.procedure import Procedure, Parameter
from pymeasure.experiment import Boolea... | ureg.m | assert | complex_expr | tests/experiment/test_results.py | test_newly_unitful | Test_csv_formatter_format | 85 | null |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D11_23",
"D13_23",
"D12_13",
... | t | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_ch_sweep_type | 131 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D... | bw | assert | variable | tests/instruments/agilent/test_agilentE5062A.py | test_ch_IF_bandwidth | 245 | null | |
pymeasure/pymeasure | import pytest
import serial
from pymeasure.adapters import SerialAdapter
def adapter():
return SerialAdapter(serial.serial_for_url("loop://", timeout=0.2))
@pytest.mark.parametrize("msg", [b"OUTP\n", b"POWER 22 dBm\n"])
def test_write_bytes(adapter, msg):
adapter.write_bytes(msg)
assert adapter.read() =... | msg.decode() | assert | func_call | tests/adapters/test_serial.py | test_write_bytes | 59 | null | |
pymeasure/pymeasure | import time
import pytest
import math
from pymeasure.instruments.keithley.keithley2306 import Keithley2306
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestKeithley2306:
RESOURCE = "USB0::10893::6039::CN57266430::INSTR"
CHANNELS = [1, 2]
RELAYS = [1, 2, 3, 4]
BOOL... | '' | assert | string_literal | tests/instruments/keithley/test_keithley2306_with_device.py | test_display_text | TestKeithley2306 | 140 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilent4156 import Agilent4156
def test_smu_channel_mode():
with expected_protocol(
Agilent4156, [(":PAGE:CHAN:SMU1:MODE?", "V"), ("SYST:ERR?", '0,"No error"')]
) as inst:
assert inst.smu1.channel_m... | "V" | assert | string_literal | tests/instruments/agilent/test_agilent4156.py | test_smu_channel_mode | 41 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentB298x import AgilentB2987
TRIGGER_LAYERS = {'ALL': 'all',
'ACQ': 'acquisition',
'TRAN': 'transient',
}
SUB_SYSTEMS = {'ARM': 'arm',
'TRIG': 'trigger... | True | assert | bool_literal | tests/instruments/agilent/test_agilentB298x.py | test_interlock_enabled | TestAmmeter | 124 | null |
pymeasure/pymeasure | import pytest
import numpy as np
from pymeasure.test import expected_protocol
from pymeasure.instruments.keysight import KeysightPNA
INITIALIZATION = [("FORM REAL,64", None),
("FORM:BORD SWAP", None),
("SYST:CHAN:CAT?", "1"),
("SYST:MEAS:CAT? 1", "1"),
... | y_data[0][1] | assert | complex_expr | tests/instruments/keysight/test_keysightPNA.py | test_y_data_complex_ascii | TestTrace | 221 | null |
pymeasure/pymeasure | import pytest
import math
import time
from pymeasure.instruments.hp import HP8116A, hp8116a
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestHP8116A:
RESOURCE = 'GPIB0::12'
HAS_OPTION_001 = True
BOOLEANS = [False, True]
OPERATING_MODES_WO_OPT001 = ['normal', 'trigg... | 0 | assert | numeric_literal | tests/instruments/hp/test_hp8116a_with_device.py | test_given_resetted_when_check_errors_then_no_error | TestHP8116A | 218 | null |
pymeasure/pymeasure | from unittest.mock import call
import pytest
from pymeasure.adapters.protocol import to_bytes, ProtocolAdapter
from pytest import mark, raises, fixture, warns
def adapter():
return ProtocolAdapter()
def mockAdapter():
adapter = ProtocolAdapter(connection_attributes={'timeout': 100},
... | 1 | assert | numeric_literal | tests/adapters/test_protocol.py | test_write_index | Test_write_bytes | 112 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.velleman import VellemanK8090, VellemanK8090Switches as Switches
def test_status():
with expected_protocol(
VellemanK8090,
[
(
bytearray.fromhex("04 18 00 00 00 E4 0F"),
... | Switches.CH1 | assert | complex_expr | tests/instruments/velleman/test_velleman_k8090.py | test_status | 81 | null | |
pymeasure/pymeasure | import pytest
import time
from pymeasure.instruments.siglenttechnologies import SDS1000XHD
def sds1000xhd(connected_device_address):
"""Fixture that provides a connected SDS1000XHD oscilloscope instance.
This fixture will be skipped if no device address is provided with the
--device-address command line a... | 0, abs=1e-6) | pytest.approx | complex_expr | tests/instruments/siglenttechnologies/test_siglent_sds1000xhd_with_device.py | test_timebase_settings | 100 | null | |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.lakeshore.lakeshore211 import LakeShore211
def test_set_analog():
with expected_protocol(
LakeShore211,
[(b"ANALOG 0,1", None),
(b"ANALOG?", b"0,1")],
) as instr:
instr.analog_configuration = (... | (0, 1) | assert | collection | tests/instruments/lakeshore/test_lakeshore211.py | test_set_analog | 61 | null | |
pymeasure/pymeasure | import pytest
from unittest import mock
from pymeasure.display.Qt import QtCore
from pymeasure.display.inputs import (ScientificInput, BooleanInput, ListInput,
VectorInput)
from pymeasure.experiment.parameters import (BooleanParameter, ListParameter, FloatParameter,
... | str(choice) | assert | func_call | tests/display/test_inputs.py | test_setValue_should_update_value | TestListInput | 129 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.anritsu import AnritsuMS464xB, AnritsuMS4642B, AnritsuMS4644B, \
AnritsuMS4645B, AnritsuMS4647B
def test_init_with_different_channel_numbers():
# Test init with different number of active channels and installed ports
wit... | 2 | assert | numeric_literal | tests/instruments/anritsu/test_anritsuMS464xB.py | test_init_with_different_channel_numbers | 52 | null | |
pymeasure/pymeasure | import logging
from unittest import mock
import numpy as np
import pytest
from pymeasure.adapters import Adapter, FakeAdapter, ProtocolAdapter
def adapter():
return Adapter()
def fake():
return FakeAdapter()
class TestLoggingForTestGenerator:
message = b"some written message"
def adapter(self, ca... | (read,) | assert | collection | tests/adapters/test_adapter.py | test_read | TestLoggingForTestGenerator | 138 | null |
pymeasure/pymeasure | import numpy as np
import pytest
from pymeasure.experiment.parameters import Parameter
from pymeasure.experiment.parameters import IntegerParameter
from pymeasure.experiment.parameters import BooleanParameter
from pymeasure.experiment.parameters import FloatParameter
from pymeasure.experiment.parameters import ListPar... | 0 | assert | numeric_literal | tests/experiment/test_parameters.py | test_integer_value | 58 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.display.Qt import QtCore
from pymeasure.experiment import Procedure, BooleanParameter, Parameter, FloatParameter, \
IntegerParameter, ListParameter
from pymeasure.display.widgets import InputsWidget
@pytest.mark.parametrize(
"hide_groups,exp_visible,exp_enabled", [
(True, ... | True | assert | bool_literal | tests/display/widgets/test_inputs_widget.py | test_input_toggling | 53 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilent33500 import Agilent33500
from math import pi, sin
pytest.skip('Only works with connected hardware', allow_module_level=True)
def generator():
try:
generator = Agilent33500("TCPIP::192.168.225.208::inst0::INSTR")
except IOError:
print("No... | generator.id | assert | complex_expr | tests/instruments/agilent/test_agilent33500_with_device.py | test_get_instrument_id | 115 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments import Instrument, SCPIMixin
def scpi_device(connected_device_address):
scpi_device = SCPIDevice(connected_device_address)
scpi_device.clear()
return scpi_device
def test_complete(scpi_device):
assert scpi_device.complete == | "1" | assert | string_literal | tests/instruments/test_scpi_mixin_with_device.py | test_complete | 44 | null | |
pymeasure/pymeasure | import importlib.util
import pytest
import pyvisa
from pymeasure.adapters import VISAAdapter
from pymeasure.test import expected_protocol
SIM_RESOURCE = 'ASRL2::INSTR'
is_pyvisa_sim_installed = bool(importlib.util.find_spec('pyvisa_sim'))
def adapter():
adapter = VISAAdapter(SIM_RESOURCE, visa_library='@sim',
... | 1 | assert | numeric_literal | tests/adapters/test_visa.py | test_write_read | 111 | null | |
pymeasure/pymeasure | import pytest
import math
import time
from pymeasure.instruments.hp import HP8116A, hp8116a
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestHP8116A:
RESOURCE = 'GPIB0::12'
HAS_OPTION_001 = True
BOOLEANS = [False, True]
OPERATING_MODES_WO_OPT001 = ['normal', 'trigg... | 2 | assert | numeric_literal | tests/instruments/hp/test_hp8116a_with_device.py | test_given_two_error_conditions_when_check_errors_then_two_errors | TestHP8116A | 241 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.ametek import Ametek7270
def test_harmonic_getter():
with expected_protocol(
Ametek7270,
[(b'REFN', b'7\n')],
) as inst:
assert inst.harmonic == | 7 | assert | numeric_literal | tests/instruments/ametek/test_ametek7270.py | test_harmonic_getter | 98 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5270B import AgilentE5270B
def e5270b(connected_device_address,
timeout=2000,
):
instr = AgilentE5270B(connected_device_address)
instr.reset()
return instr
class TestSMU:
def test_voltage(self, e5270b):
e5270b.smu1.... | 1, rel=1e-3) | pytest.approx | complex_expr | tests/instruments/agilent/test_agilentE5270B_with_device.py | test_voltage | TestSMU | 80 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.aimtti.ld400p import LD400P
def test_mode():
with expected_protocol(
LD400P,
[
("MODE P", None),
("MODE?", "MODE P"),
],
) as inst:
inst.mode = "P"
assert inst... | "P" | assert | string_literal | tests/instruments/aimtti/test_ld400p.py | test_mode | 40 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5270B import AgilentE5270B
def e5270b(connected_device_address,
timeout=2000,
):
instr = AgilentE5270B(connected_device_address)
instr.reset()
return instr
class TestMain:
@pytest.mark.parametrize("error_code, error_messag... | got | assert | variable | tests/instruments/agilent/test_agilentE5270B_with_device.py | test_get_error_message | TestMain | 61 | null |
pymeasure/pymeasure | import pytest
from unittest import mock
from pymeasure.display.Qt import QtCore
from pymeasure.display.inputs import (ScientificInput, BooleanInput, ListInput,
VectorInput)
from pymeasure.experiment.parameters import (BooleanParameter, ListParameter, FloatParameter,
... | 5 | assert | numeric_literal | tests/display/test_inputs.py | test_setValue_within_range_should_set | TestScientificInput | 202 | null |
pymeasure/pymeasure | import os
import pickle
import tempfile
from unittest import mock
import pandas as pd
import pytest
import numpy as np
from pymeasure.units import ureg
from pymeasure.experiment.results import Results, CSVFormatter
from pymeasure.experiment.procedure import Procedure, Parameter
from pymeasure.experiment import Boolea... | True | assert | bool_literal | tests/experiment/test_results.py | test_parameter_reading | 173 | null | |
pymeasure/pymeasure | from __future__ import annotations
from contextlib import contextmanager
from typing import Any, Generator, Optional, Sequence, TypeVar, Union
from pymeasure.adapters.protocol import ProtocolAdapter, BYTABLE
from pymeasure.instruments import Instrument
Inst = TypeVar("Inst", bound=Instrument)
@contextmanager
def ex... | None | assert | none_literal | pymeasure/test.py | expected_protocol | 75 | null | |
pymeasure/pymeasure | import importlib
import logging
import pytest
import os
import tempfile
from time import sleep
from pymeasure.experiment import Listener, Procedure
from pymeasure.experiment.workers import Worker
from pymeasure.experiment.results import Results
from data.procedure_for_testing import RandomProcedure
tcp_libs_availabl... | 3 | assert | numeric_literal | tests/experiment/test_workers.py | test_zmq_topic_filtering_works | 130 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.aja.dcxs import DCXS
def test_enabled():
"""
Test DCXS enabled
"""
with expected_protocol(
DCXS,
[
("A", None),
("a", "1"),
],
) as inst:
inst.enabled = Tru... | True | assert | bool_literal | tests/instruments/aja/test_dcxs.py | test_enabled | 85 | null | |
pymeasure/pymeasure | from unittest.mock import call
import pytest
from pymeasure.adapters.protocol import to_bytes, ProtocolAdapter
from pytest import mark, raises, fixture, warns
def adapter():
return ProtocolAdapter()
def mockAdapter():
adapter = ProtocolAdapter(connection_attributes={'timeout': 100},
... | "" | assert | string_literal | tests/adapters/test_protocol.py | test_read_empty_message | Test_read | 158 | null |
pymeasure/pymeasure | import time
import pytest
import math
from pymeasure.instruments.keithley.keithley2306 import Keithley2306
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestKeithley2306:
RESOURCE = "USB0::10893::6039::CN57266430::INSTR"
CHANNELS = [1, 2]
RELAYS = [1, 2, 3, 4]
BOOL... | 8 | assert | numeric_literal | tests/instruments/keithley/test_keithley2306_with_device.py | test_source_voltage_protection | TestKeithley2306 | 481 | null |
pymeasure/pymeasure | import time
from unittest import mock
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments import Instrument, Channel
from pymeasure.adapters import FakeAdapter, ProtocolAdapter
from pymeasure.instruments.fakes import FakeInstrument
from pymeasure.instruments.validators import truncat... | True | assert | bool_literal | tests/instruments/test_instrument.py | test_instrument_in_context | 145 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.anritsu import AnritsuMS464xB, AnritsuMS4642B, AnritsuMS4644B, \
AnritsuMS4645B, AnritsuMS4647B
def test_init():
with expected_protocol(
AnritsuMS464xB,
[],
) as instr:
assert len(instr.channels) ... | 4 | assert | numeric_literal | tests/instruments/anritsu/test_anritsuMS464xB.py | test_init | 38 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilent34450A import Agilent34450A
from pyvisa.errors import VisaIOError
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestAgilent34450A:
RESOURCE = "USB0::10893::45848::MY56511723::0::INSTR"
BOOLEANS = [False, True]
RESO... | 1 | assert | numeric_literal | tests/instruments/agilent/test_agilent34450A_with_device.py | test_configure_current | TestAgilent34450A | 155 | null |
pymeasure/pymeasure | import pytest
import numpy as np
from pymeasure.instruments.keysight.keysightPNA import KeysightPNA
def keysightPNA_default(connected_device_address):
instr = KeysightPNA(connected_device_address)
return instr
def keysightPNA(connected_device_address):
instr = KeysightPNA(connected_device_address, timeout... | 0 | assert | numeric_literal | tests/instruments/keysight/test_keysightPNA_with_device.py | test_number_of_points | TestMeasurementChannel | 112 | null |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentN8975A import AgilentN8975A
def n8975a(connected_device_address,
timeout=30000,
):
instr = AgilentN8975A(connected_device_address, timeout=timeout)
instr.reset()
instr.clear()
assert [] == instr.check_errors()
return inst... | type(gain) | assert | func_call | tests/instruments/agilent/test_agilentN8975A_with_device.py | test_gain | TestFixedMode | 131 | null |
pymeasure/pymeasure | from unittest.mock import call
import pytest
from pymeasure.adapters.protocol import to_bytes, ProtocolAdapter
from pytest import mark, raises, fixture, warns
def adapter():
return ProtocolAdapter()
def mockAdapter():
adapter = ProtocolAdapter(connection_attributes={'timeout': 100},
... | b"5" | assert | string_literal | tests/adapters/test_protocol.py | test_write | Test_write | 83 | null |
pymeasure/pymeasure | from __future__ import annotations
import logging
from typing import cast, Optional, Sequence, Union
from unittest.mock import MagicMock
from warnings import warn
from .adapter import Adapter
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
BYTABLE = Union[bytes, bytearray, str, list[int], tup... | None | assert | none_literal | pymeasure/adapters/protocol.py | _write | ProtocolAdapter | 113 | null |
pymeasure/pymeasure | import importlib.util
import pytest
import pyvisa
from pymeasure.adapters import VISAAdapter
from pymeasure.test import expected_protocol
SIM_RESOURCE = 'ASRL2::INSTR'
is_pyvisa_sim_installed = bool(importlib.util.find_spec('pyvisa_sim'))
def adapter():
adapter = VISAAdapter(SIM_RESOURCE, visa_library='@sim',
... | a0.manager | assert | complex_expr | tests/adapters/test_visa.py | test_nested_adapter | 65 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.agilent.agilentE5062A import AgilentE5062A
import numpy as np
DISPLAY_LAYOUT_OPTIONS = [
"D1",
"D12",
"D1_2",
"D112",
"D1_1_2",
"D123",
"D1_2_3",
"D12_33",
"D11_23",
"D13_23",
"D12_13",
... | f | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_ch_start_frequency | 89 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.hp.hp34401A import HP34401A
def test_reading():
with expected_protocol(
HP34401A,
[
("READ?", "1")
],
) as inst:
assert 1 == | inst.reading | assert | complex_expr | tests/instruments/hp/test_hp34401a.py | test_reading | 236 | null | |
pymeasure/pymeasure | import numpy as np
import pytest
from pymeasure.experiment.parameters import Parameter
from pymeasure.experiment.parameters import IntegerParameter
from pymeasure.experiment.parameters import BooleanParameter
from pymeasure.experiment.parameters import FloatParameter
from pymeasure.experiment.parameters import ListPar... | 5 | assert | numeric_literal | tests/experiment/test_parameters.py | test_parameter_default | 38 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.ptw.ptwUNIDOS import ptwUNIDOS
from time import sleep
RANGES = ["VERY_LOW", "LOW", "MEDIUM", "HIGH"]
LEVELS = ["LOW", "MEDIUM", "HIGH"]
STATUS = ["RES", "MEAS", "HOLD", "INT", "INTHLD", "ZERO",
"AUTO", "AUTO_MEAS", "AUTO_HOLD", "EOM", "WAIT",
"INIT", "ERROR"... | 0 | assert | numeric_literal | tests/instruments/ptw/test_ptwUNIDOS_with_device.py | test_id | TestPTWUnidosProperties | 72 | null |
pymeasure/pymeasure | import time
import pytest
import math
from pymeasure.instruments.keithley.keithley2306 import Keithley2306
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestKeithley2306:
RESOURCE = "USB0::10893::6039::CN57266430::INSTR"
CHANNELS = [1, 2]
RELAYS = [1, 2, 3, 4]
BOOL... | 1 | assert | numeric_literal | tests/instruments/keithley/test_keithley2306_with_device.py | test_display_channel | TestKeithley2306 | 132 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentN8975A import AgilentN8975A
class TestAgilentN8975A:
@pytest.mark.parametrize("average", [1, 999])
def test_average(self, average):
with expected_protocol(
AgilentN8975A,
[(f"AV... | inst.average | assert | complex_expr | tests/instruments/agilent/test_agilentN8975A.py | test_average | TestAgilentN8975A | 75 | null |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley.keithley2510 import Keithley2510
def test_temperature_protection_range():
with expected_protocol(
Keithley2510,
[
(b":SOURce:TEMPerature:PROTection:LOW 5", None),
(b":SOURce:TEMPerature:PROTecti... | (5, 100) | assert | collection | tests/instruments/keithley/test_keithley2510.py | test_temperature_protection_range | 89 | null | |
pymeasure/pymeasure | from unittest.mock import call
import pytest
from pymeasure.adapters.protocol import to_bytes, ProtocolAdapter
from pytest import mark, raises, fixture, warns
def adapter():
return ProtocolAdapter()
def mockAdapter():
adapter = ProtocolAdapter(connection_attributes={'timeout': 100},
... | None | assert | none_literal | tests/adapters/test_protocol.py | test_write_without_response | Test_write | 88 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilentE5270B import AgilentE5270B
INITIALIZATION = ("UNT?", "E5281B,0;E5281B,0;E5281B,0;E5281B,0;0,0;E5280B,0;0,0;E5280B,0")
class TestMain:
def test_get_error_message(self):
with expected_protocol(
... | got | assert | variable | tests/instruments/agilent/test_agilentE5270B.py | test_get_error_message | TestMain | 49 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley.keithley2182 import Keithley2182
def test_thermocouple():
with expected_protocol(
Keithley2182,
[(":SENS:TEMP:TC?", "S"),
(":SENS:TEMP:TC K", None),
],
) as inst:
assert in... | 'S' | assert | string_literal | tests/instruments/keithley/test_keithley2182.py | test_thermocouple | 78 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.ptw.ptwUNIDOS import ptwUNIDOS
RANGES = ["VERY_LOW", "LOW", "MEDIUM", "HIGH"]
LEVELS = ["LOW", "MEDIUM", "HIGH"]
def test_tfi():
"""Verify the communication of the tfi getter."""
with expected_protocol(
ptwUNIDOS,
... | "-" | assert | string_literal | tests/instruments/ptw/test_ptwUNIDOS.py | test_tfi | 190 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.mksinst.mks974b import MKS974B, Unit
def test_unit_getter():
"""Verify the communication of the unit getter."""
with expected_protocol(
MKS974B,
[("@253U?", "@253ACKTORR"),
(None, b"FF")],
) as i... | Unit.Torr | assert | complex_expr | tests/instruments/mksinst/test_mks974b.py | test_unit_getter | 87 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.ptw.ptwUNIDOS import ptwUNIDOS
from time import sleep
RANGES = ["VERY_LOW", "LOW", "MEDIUM", "HIGH"]
LEVELS = ["LOW", "MEDIUM", "HIGH"]
STATUS = ["RES", "MEAS", "HOLD", "INT", "INTHLD", "ZERO",
"AUTO", "AUTO_MEAS", "AUTO_HOLD", "EOM", "WAIT",
"INIT", "ERROR"... | str | assert | variable | tests/instruments/ptw/test_ptwUNIDOS_with_device.py | test_measurement_result | TestPTWUnidosProperties | 85 | null |
pymeasure/pymeasure | import logging
from time import sleep
import numpy
import pytest
from pymeasure.adapters import PrologixAdapter
from pymeasure.instruments.hp import HP8753E
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
def hp8753e(connected_device_address):
try:
# This allows a PrologixAdapter... | 0 | assert | numeric_literal | tests/instruments/hp/test_hp8753e_with_device.py | test_hp8753e_with_device_sweep_time | 113 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.validators import (
strict_range, strict_discrete_range, strict_discrete_set,
truncated_range, truncated_discrete_set,
modular_range, modular_range_bidirectional,
joined_validators
)
def test_truncated_range():
assert truncated_range(5, range(10)) == 5
a... | 0 | assert | numeric_literal | tests/instruments/test_validators.py | test_truncated_range | 66 | null | |
pymeasure/pymeasure | import os
import pickle
import tempfile
from unittest import mock
import pandas as pd
import pytest
import numpy as np
from pymeasure.units import ureg
from pymeasure.experiment.results import Results, CSVFormatter
from pymeasure.experiment.procedure import Procedure, Parameter
from pymeasure.experiment import Boolea... | "5" | assert | string_literal | tests/experiment/test_results.py | test_no_newly_unitful | Test_csv_formatter_format | 89 | null |
pymeasure/pymeasure | from time import sleep
import logging
import pytest
import numpy as np
from pymeasure.instruments.keysight.keysightDSOX1102G import KeysightDSOX1102G
from pyvisa.errors import VisaIOError
pytest.skip('Only work with connected hardware', allow_module_level=True)
class TestKeysightDSOX1102G:
RESOURCE = "USB0::108... | 0 | assert | numeric_literal | tests/instruments/keysight/test_keysightDSOX1102G_with_device.py | test_waveform_data | TestKeysightDSOX1102G | 265 | null |
sooperset/mcp-atlassian | from unittest.mock import MagicMock, patch
import pytest
from mcp_atlassian.jira import JiraFetcher
from mcp_atlassian.jira.formatting import FormattingMixin
from mcp_atlassian.preprocessing import JiraPreprocessor
def formatting_mixin(jira_fetcher: JiraFetcher) -> FormattingMixin:
"""Fixture to create a Formatt... | result | assert | variable | tests/unit/jira/test_formatting.py | test_format_issue_content_basic | 74 | null | |
sooperset/mcp-atlassian | from unittest.mock import patch
import pytest
import requests
from mcp_atlassian.confluence.spaces import SpacesMixin
from tests.fixtures.confluence_mocks import MOCK_SPACES_RESPONSE
class TestSpacesMixin:
def spaces_mixin(self, confluence_client):
"""Create a SpacesMixin instance for testing."""
... | result | assert | variable | tests/unit/confluence/test_spaces.py | test_get_user_contributed_spaces_extraction_methods | TestSpacesMixin | 96 | null |
sooperset/mcp-atlassian | import os
import subprocess
import sys
import tempfile
from pathlib import Path
import pytest
class TestStdinMonitoringFix:
def test_code_structure_validates_fix(self):
"""Validate that stdio uses EOF monitoring while HTTP does not."""
# Read the main module source directly
main_file = (
... | source | assert | variable | tests/unit/test_stdin_monitoring_fix.py | test_code_structure_validates_fix | TestStdinMonitoringFix | 78 | null |
sooperset/mcp-atlassian | from unittest.mock import MagicMock, patch
import pytest
import requests
from mcp_atlassian.jira.config import JiraConfig
from mcp_atlassian.jira.users import UsersMixin, normalize_text
class TestNormalizeText:
def test_normalize_text_empty_string(self):
"""Test normalize_text with empty string."""
... | "" | assert | string_literal | tests/unit/jira/test_users.py | test_normalize_text_empty_string | TestNormalizeText | 782 | null |
sooperset/mcp-atlassian | import os
from unittest.mock import patch
import pytest
from mcp_atlassian.confluence.config import ConfluenceConfig
def test_from_env_oauth_enable_no_url():
"""Test BYOT OAuth mode — ATLASSIAN_OAUTH_ENABLE=true without URL."""
with patch.dict(
os.environ,
{"ATLASSIAN_OAUTH_ENABLE": "true"},
... | "" | assert | string_literal | tests/unit/confluence/test_config.py | test_from_env_oauth_enable_no_url | 283 | null | |
sooperset/mcp-atlassian | import asyncio
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from mcp_atlassian import _run_stdio_with_stdin_guard, main
class TestMainTransportSelection:
def mock_server(self):
"""Create a mock server instance."""
server = MagicMock()
server.run_async = AsyncMock(r... | 2 | assert | numeric_literal | tests/unit/test_main_transport_selection.py | test_error_handling_preserved | TestMainTransportSelection | 186 | null |
sooperset/mcp-atlassian | from __future__ import annotations
import json
import os
import uuid
from typing import Any
from unittest.mock import patch
import pytest
from fastmcp import Client
from fastmcp.client import FastMCPTransport
from mcp.types import CallToolResult, TextContent
from mcp_atlassian.servers import main_mcp
from .conftest... | desc | assert | variable | tests/e2e/cloud/test_adf_write.py | test_create_issue_bold_italic | TestADFCreateIssue | 118 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.