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 |
|---|---|---|---|---|---|---|---|---|---|
Cranot/roam-code | from __future__ import annotations
import json
import os
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import (
git_init,
index_in_process,
)
from roam.commands.cmd_cut import cut
def run_cut(runner, projec... | le | assert | variable | tests/test_cut.py | test_cut_leak_edge_fields | TestCutLeakEdges | 278 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sqlite3
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import git_commit, git_init, index_in_process, invoke_cli
class TestInfoSchemaGuard:
def test_drop_column_without_guard_still_flagged(self... | 1 | assert | numeric_literal | tests/test_annotations.py | test_drop_column_without_guard_still_flagged | TestInfoSchemaGuard | 214 | null |
Cranot/roam-code | from __future__ import annotations
import json
from roam.output.formatter import (
abbrev_kind,
compact_json_envelope,
format_edge_kind,
format_signature,
format_table,
format_table_compact,
indent,
loc,
section,
symbol_line,
table_to_dicts,
to_json,
truncate_lines,... | "cls" | assert | string_literal | tests/test_formatters.py | test_class | TestAbbrevKind | 32 | null |
Cranot/roam-code | from __future__ import annotations
import json
import os
import subprocess
import sys
import pytest
from click.testing import CliRunner
def roam(*args, cwd=None):
"""Run a roam CLI command and return (output, returncode)."""
result = subprocess.run(
[sys.executable, "-m", "roam"] + list(args),
... | 0 | assert | numeric_literal | tests/conftest.py | parse_json_output | 142 | null | |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def cli_runner():
from click.testing impor... | 0 | assert | numeric_literal | tests/test_attest.py | attest_project | 69 | null | |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def drift_project(tmp_path):
"""Laravel+TS project with deliberate field mismatches."""
proj = tmp_path / "drift_proj"
proj.... | result.output | assert | complex_expr | tests/test_api_drift.py | test_verdict_line | TestApiDriftText | 88 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def adr_project(tmp_path):
proj = tmp_path / "adr_proj"
proj.mkdir()
(proj / ".gitignore").write_text(".roam/\n")
# Sou... | adr | assert | variable | tests/test_adrs.py | test_adr_entries_have_expected_fields | TestAdrsJSON | 89 | null |
Cranot/roam-code | from __future__ import annotations
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import assert_json_envelope, invoke_cli, parse_json_output
from roam.cli import cli
def cli_runner():
"""Provide a Click CliRunne... | 1 | assert | numeric_literal | tests/test_closure.py | test_closure_counts | TestClosure | 162 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
_MIGRATION_WITH_ISSUES = """\
<?php
use Illuminate\\Database\\Migrations\\Migration;
use Illuminate\\Database\\Schema\\Blueprint;
use I... | "low" | assert | string_literal | tests/test_migration_safety.py | test_confidence_low_filter | TestMigrationSafetyFilters | 420 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
)
def cli_runner():
from click.testing import CliRunner
return... | 2 | assert | numeric_literal | tests/test_budget.py | test_budget_evaluate_max_increase | TestBudget | 229 | null |
Cranot/roam-code | from __future__ import annotations
import json
import pytest
from roam.bridges import registry as bridge_registry
from roam.bridges.bridge_config import ConfigBridge
from roam.bridges.bridge_rest_api import RestApiBridge
from roam.bridges.bridge_template import TemplateBridge
from tests.conftest import invoke_cli
d... | 1 | assert | numeric_literal | tests/test_bridges_extended.py | test_rest_api_resolve_urls | TestRestApiBridge | 130 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import assert_json_envelope, invoke_cli, parse_json_output
from roam.cli import cli
def cli_runner():
"""Provide a Cl... | 0 | assert | numeric_literal | tests/test_commands_refactoring.py | test_dead_runs | TestDead | 45 | null |
Cranot/roam-code | from __future__ import annotations
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import assert_json_envelope, invoke_cli, parse_json_output
def agent_project(project_factory):
return project_factory(
{
... | 3 | assert | numeric_literal | tests/test_agent_plan_context.py | test_agent_plan_json | 53 | null | |
Cranot/roam-code | from __future__ import annotations
from roam.index.file_roles import (
ALL_ROLES,
classify_file,
is_generated,
is_source,
is_test,
is_vendored,
)
class TestTier1PathBased:
def test_github_workflow(self):
assert classify_file(".github/workflows/ci.yml") == | "ci" | assert | string_literal | tests/test_file_roles.py | test_github_workflow | TestTier1PathBased | 24 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def adr_project(tmp_path):
proj = tmp_path / "adr_proj"
proj.mkdir()
(proj / ".gitignore").write_text(".roam/\n")
# Sou... | 0 | assert | numeric_literal | tests/test_adrs.py | test_exits_zero | TestAdrsSmoke | 56 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def laravel_project(tmp_path):
"""Laravel-style PHP project with routes and controllers."""
proj = tmp_path / "laravel_proj"
... | [] | assert | collection | tests/test_auth_gaps.py | test_routes_only_skips_controller_section | TestAuthGapsText | 223 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sqlite3
from pathlib import Path
import pytest
from click.testing import CliRunner
def tmp_project(tmp_path: Path):
"""Create a minimal project directory with .roam dir and index DB."""
(tmp_path / ".roam").mkdir()
db_path = tmp_path / ".roam" / "inde... | p | assert | variable | tests/test_rule_profiles.py | test_list_profiles_structure | TestListProfiles | 203 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import (
assert_json_envelope,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def cli_runner():
from click.testing impor... | None | assert | none_literal | tests/test_attest.py | test_attest_has_risk | TestAttestEvidence | 176 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import git_commit, git_init, index_in_process, roam
from roam.graph.anomaly import (
cusum,
forecast,
mann_kendall_test,
modified_z_score,
... | 0 | assert | numeric_literal | tests/test_anomaly.py | test_no_anomalies_in_uniform_data | TestModifiedZScore | 57 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from click.testing import CliRunner
def _make_graph(edges):
if not HAS_NX:
pytest.skip("networkx not installed")
G = nx.DiGraph()
for src, tgt in edges:
G.add_edge(src, tgt)
return G
def _linear_graph():
return _make_graph([(1, 2),... | 2 | assert | numeric_literal | tests/test_context_propagation.py | test_linear_chain_depths | TestCalleeChain | 288 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
invoke_cli,
parse_json_output,
)
def ci_project(tmp_path):
proj = tmp_path / "ci_proj"
proj.mkdir()
(proj / ".gitignore").write_text(".roam/\n")
(proj / "main.py").write_text(... | 1 | assert | numeric_literal | tests/test_ci_setup.py | test_write_creates_file | TestCiSetupWrite | 93 | null |
Cranot/roam-code | from __future__ import annotations
from roam.index.file_roles import (
ALL_ROLES,
classify_file,
is_generated,
is_source,
is_test,
is_vendored,
)
class TestIsVendored:
def test_vendor_dir(self):
assert is_vendored("vendor/pkg/errors.go") is | True | assert | bool_literal | tests/test_file_roles.py | test_vendor_dir | TestIsVendored | 384 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from roam.graph.dark_matter import HypothesisEngine, dark_matter_edges
from tests.conftest import assert_json_envelope, invoke_cli, parse_json_output
def dark_matter_project(project_factory, monkeypatch):
"""Project where billing.py <-> reporting.py co-change 3+ t... | e | assert | variable | tests/test_dark_matter.py | test_dark_matter_edges_function | TestDarkMatterEdgesFunction | 192 | null |
Cranot/roam-code | from __future__ import annotations
import json
import os
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import git_init, index_in_process
def run_adversarial(proj, args=None, json_mode=False):
"""Invoke the adver... | 0 | assert | numeric_literal | tests/test_adversarial.py | test_adversarial_runs | TestAdversarialBasic | 171 | null |
Cranot/roam-code | from __future__ import annotations
import pytest
from roam.bridges import registry as bridge_registry
from roam.bridges.base import LanguageBridge
from roam.bridges.bridge_protobuf import ProtobufBridge
from roam.bridges.bridge_salesforce import SalesforceBridge
def _reset_registry():
"""Clear the global bridge ... | b2 | assert | variable | tests/test_bridges.py | test_get_bridges_returns_copy | TestBridgeRegistry | 84 | null |
Cranot/roam-code | from __future__ import annotations
import random
import sqlite3
import string
import pytest
import networkx as nx
from roam.db.connection import batched_in, ensure_schema
from roam.graph.simulate import clone_graph, metric_delta
from roam.output.formatter import (
KIND_ABBREV,
abbrev_kind,
format_table,... | "" | assert | string_literal | tests/test_properties.py | test_empty_string | TestAbbrevKindProperties | 129 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import invoke_cli
def cli_runner():
"""Provide a Click CliRunner compatible with Click 8.2+."""
try:
retur... | "c" | assert | string_literal | tests/test_languages.py | test_c_file_skeleton | TestCCLI | 1,590 | null |
Cranot/roam-code | from __future__ import annotations
import json
import os
import sys
from pathlib import Path
import pytest
from click.testing import CliRunner
sys.path.insert(0, str(Path(__file__).parent))
from conftest import git_init, index_in_process
def run_adversarial(proj, args=None, json_mode=False):
"""Invoke the adver... | [] | assert | collection | tests/test_adversarial.py | test_check_orphaned_returns_list | TestAdversarialInternalFunctions | 612 | null |
Cranot/roam-code | from __future__ import annotations
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent))
from conftest import (
assert_json_envelope,
git_commit,
git_init,
index_in_process,
invoke_cli,
parse_json_output,
)
def cli_runner():
from click.testing i... | ea | assert | variable | tests/test_pr_diff.py | test_pr_diff_edge_analysis | TestPrDiff | 304 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sqlite3
from pathlib import Path
import networkx as nx
import pytest
from click.testing import CliRunner
from roam.cli import cli
def _make_db(tmp_path: Path) -> sqlite3.Connection:
db_path = tmp_path / ".roam" / "index.db"
db_path.parent.mkdir(parents=T... | 0 | assert | numeric_literal | tests/test_check_rules.py | test_calculate_verdict_empty | 667 | null | |
Cranot/roam-code | from __future__ import annotations
import sqlite3
from unittest.mock import patch
import pytest
def tmp_db(tmp_path):
"""Create a minimal in-memory-style SQLite DB with required tables."""
db_path = tmp_path / ".roam" / "index.db"
db_path.parent.mkdir(parents=True)
conn = sqlite3.connect(str(db_path... | 0 | assert | numeric_literal | tests/test_batch_mcp.py | test_empty_queries_returns_empty_results | TestBatchSearch | 404 | null |
Cranot/roam-code | from __future__ import annotations
import os
import pytest
from tests.conftest import (
assert_json_envelope,
git_init,
index_in_process,
parse_json_output,
)
def invoke_coverage_gaps(runner, args=None, cwd=None, json_mode=False):
"""Invoke the coverage-gaps command directly, bypassing the CLI g... | pct | assert | variable | tests/test_coverage_gaps_cmd.py | test_json_coverage_pct_range | TestCoverageGapsJSON | 306 | null |
Cranot/roam-code | from __future__ import annotations
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from conftest import assert_json_envelope, invoke_cli, parse_json_output
from roam.cli import cli
class TestHealth:
def test_health_shows_score(self, cli_runner, indexed_project, mo... | 0 | assert | numeric_literal | tests/test_commands_health.py | test_health_shows_score | TestHealth | 30 | 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... | (100, 2) | assert | collection | tests/experiment/test_workers.py | test_worker_finish | 65 | null | |
pymeasure/pymeasure | from pymeasure.instruments.keithley.keithley2750 import clean_closed_channels
def test_clean_closed_channels():
# Example outputs from `self.ask(":ROUTe:CLOSe?")`
example_outputs = ["(@)", # if no channels are open. It is a string and not a list
"(@101)", # if only 1 channel is open. I... | [101] | assert | collection | tests/instruments/keithley/test_keithley2750.py | test_clean_closed_channels | 36 | null | |
pymeasure/pymeasure | from pymeasure.instruments.keithley.keithley2750 import clean_closed_channels
def test_clean_closed_channels():
# Example outputs from `self.ask(":ROUTe:CLOSe?")`
example_outputs = ["(@)", # if no channels are open. It is a string and not a list
"(@101)", # if only 1 channel is open. I... | [] | assert | collection | tests/instruments/keithley/test_keithley2750.py | test_clean_closed_channels | 35 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.keithley import Keithley4200
from pymeasure.instruments.keithley.keithley4200 import StatusCode
def keithley4200(connected_device_address):
instr = Keithley4200(connected_device_address)
instr.clear()
return instr
class TestKeithley4200:
def test_options(self,... | str | assert | variable | tests/instruments/keithley/test_keithley4200_with_device.py | test_options | TestKeithley4200 | 60 | 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",
... | opt | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_ch_visible_traces | 68 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.experiment.parameters import Metadata
from pymeasure.experiment.procedure import Procedure
def test_metadata_default():
p = Metadata('Test', default=5)
assert p.value == | 5 | assert | numeric_literal | tests/experiment/test_metadata.py | test_metadata_default | 33 | null | |
pymeasure/pymeasure | import pytest
import logging
from pymeasure.instruments.keithley import KeithleyDMM6500
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
FUNCTIONS = [
"voltage",
"voltage ac",
"current",
"current ac",
"resistance",
"resistance 4W",
"diode",
"capacitance",
"te... | 0 | assert | numeric_literal | tests/instruments/keithley/test_keithleyDMM6500_with_device.py | test_given_function_when_set_then_function_is_set | 139 | 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
@pytest.mark.parametrize("valid_header_no_unit", (
["x"], ["x ( x + ... | {} | assert | collection | tests/experiment/test_procedure.py | test_procedure_no_parsed_units | 118 | 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... | p | assert | variable | tests/instruments/agilent/test_agilentE5062A.py | test_ch_traces | 110 | 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"),
... | np.ndarray | assert | complex_expr | tests/instruments/keysight/test_keysightPNA.py | test_x_data_ascii | TestTrace | 152 | null |
pymeasure/pymeasure | import pytest
from io import StringIO
from pymeasure.experiment.sequencer import SequenceHandler, SequenceEvaluationError
def non_empty_lines(text):
lines = text.split("\n")
linect = 0
for line in lines:
if line.strip() != "":
linect += 1
return linect
@pytest.mark.parametrize("se... | c | assert | variable | tests/experiment/test_sequencer.py | test_sequencer | 84 | 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,
... | ' m' | assert | string_literal | tests/display/test_inputs.py | test_init_from_param | TestScientificInput | 192 | null |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.anritsu import AnritsuMG3692C
def test_output():
with expected_protocol(
AnritsuMG3692C,
[(b":OUTPUT?", "1")],
) as instr:
assert instr.output is | True | assert | bool_literal | tests/instruments/anritsu/test_anritsuMG3692C.py | test_output | 75 | null | |
pymeasure/pymeasure | from datetime import datetime
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.hp import HP8560A, HP8561B
from pymeasure.instruments.hp.hp856Xx import Trace, MixerMode, CouplingMode, DemodulationMode, \
DetectionModes, AmplitudeUnits, HP856Xx, ErrorCode, FrequencyReference, P... | 8 | assert | numeric_literal | tests/instruments/hp/test_hp856Xx.py | test_normalized_reference_position | TestHP856Xx | 526 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.velleman import VellemanK8090, VellemanK8090Switches as Switches
def test_version():
with expected_protocol(
VellemanK8090,
[
(
bytearray.fromhex("04 71 00 00 00 8B 0F"),
... | (10, 1) | assert | collection | tests/instruments/velleman/test_velleman_k8090.py | test_version | 47 | 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... | opt | assert | variable | tests/instruments/agilent/test_agilentE5062A.py | test_ch_visible_traces | 89 | 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... | 9 | assert | numeric_literal | tests/instruments/test_validators.py | test_truncated_range | 67 | 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"),
... | inst.options | assert | complex_expr | tests/instruments/keysight/test_keysightPNA.py | test_options | TestKeysightPNA | 373 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.tdk.tdk_gen40_38 import TDK_Gen40_38
@pytest.mark.parametrize("volt",
(b"10", b"20", b"40"))
def test_voltage_setpoint(volt):
with expected_protocol(
TDK_Gen40_38,
[(b"ADR 6", b"O... | float(volt) | assert | func_call | tests/instruments/tdk/test_tdk_gen40-38.py | test_voltage_setpoint | 49 | 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",
... | src | assert | variable | tests/instruments/agilent/test_agilentE5062A_with_device.py | test_trigger_source | 260 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.keysight.keysight81160A import (
AMPLITUDE_RANGE,
BURST_NCYCLES,
BURST_PERIOD,
FREQUENCY_RANGE,
FREQUENCY_SIN_RANGE,
IMPEDANCE_RANGE,
LIMIT_HIGH_RANGE,
LIMIT_LOW_RANGE,
OFFSET_RANGE,
PULSE_DUTYCYCLE_RANGE,
PULSE_PERIOD_RANGE,
PULS... | ch.waveforms | assert | complex_expr | tests/instruments/keysight/test_keysight81160A_with_device.py | test_uploaded_user_waveform_channel | 383 | 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()
def test_init(adapter):
assert adapter.connection is | None | assert | none_literal | tests/adapters/test_adapter.py | test_init | 45 | 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_check_get_errors():
with expected_protocol(ChannelInstrument,
[("CA:x... | 5 | assert | numeric_literal | tests/instruments/test_channel.py | test_channel_check_get_errors | 210 | null | |
pymeasure/pymeasure | import pytest
from serial import Serial
from time import time
from pymeasure.adapters import SerialAdapter
class TestSerialLoopback:
ADAPTER_TIMEOUT = 1.0 # Seconds
def adapter(self, connected_device_address):
device = connected_device_address.split(",")[0]
return SerialAdapter(
... | 3 | assert | numeric_literal | tests/adapters/test_serial_with_loopback.py | test_read | TestSerialLoopback | 43 | 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... | src | assert | variable | tests/instruments/agilent/test_agilentE5062A.py | test_trigger_source | 416 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.tdk.tdk_gen80_65 import TDK_Gen80_65
@pytest.mark.parametrize("volt",
(b"10", b"20", b"40"))
def test_voltage_setpoint(volt):
with expected_protocol(
TDK_Gen80_65,
[(b"ADR 6", b"O... | float(volt) | assert | func_call | tests/instruments/tdk/test_tdk_gen80-65.py | test_voltage_setpoint | 49 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.teledyne.teledyne_oscilloscope import sanitize_source
from pymeasure.instruments.lecroy.lecroyT3DSO1204 import LeCroyT3DSO1204
from pymeasure.test import expected_protocol
INVALID_CHANNELS = ["INVALID_SOURCE", "C1 C2", "C1 MATH", "C1234567", "CHANNEL"]
VALID_CHANNELS = [('C1',... | y[0] | assert | complex_expr | tests/instruments/lecroy/test_lecroyT3DSO1204.py | test_download_two_points | 341 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.mksinst.mks937b import MKS937B, Unit
def test_unit_getter():
"""Verify the communication of the unit getter."""
with expected_protocol(
MKS937B,
[("@253U?", "@253ACKTORR"),
(None, b"FF")],
) as i... | Unit.Torr | assert | complex_expr | tests/instruments/mksinst/test_mks937b.py | test_unit_getter | 77 | 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... | self.message | assert | complex_expr | tests/adapters/test_adapter.py | test_read_bytes | TestLoggingForTestGenerator | 143 | null |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.keithley import Keithley4200
from pymeasure.instruments.keithley.keithley4200 import StatusCode
def keithley4200(connected_device_address):
instr = Keithley4200(connected_device_address)
instr.clear()
return instr
class TestKeithley4200SMU:
@pytest.mark.parame... | 0, abs=1e-6) | pytest.approx | complex_expr | tests/instruments/keithley/test_keithley4200_with_device.py | test_current | TestKeithley4200SMU | 96 | 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},
... | 0 | assert | numeric_literal | tests/adapters/test_protocol.py | test_partial_write | Test_write_bytes | 120 | 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"]
@pytest.mark.parametrize("it", (1, 600, 1E6))
def test_integration_time(it):
"""Verify the communication of the int... | it | assert | variable | tests/instruments/ptw/test_ptwUNIDOS.py | test_integration_time | 66 | null | |
pymeasure/pymeasure | from datetime import datetime
import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.hp import HP8560A, HP8561B
from pymeasure.instruments.hp.hp856Xx import Trace, MixerMode, CouplingMode, DemodulationMode, \
DetectionModes, AmplitudeUnits, HP856Xx, ErrorCode, FrequencyReference, P... | [] | assert | collection | tests/instruments/hp/test_hp856Xx.py | test_empty_errors | TestHP856Xx | 253 | null |
pymeasure/pymeasure | from pymeasure.thread import StoppableThread
def test_thread_stopping():
t = StoppableThread()
t.start()
t.stop()
assert t.should_stop() is | True | assert | bool_literal | tests/test_thread.py | test_thread_stopping | 32 | null | |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments import Instrument
from pymeasure.instruments.activetechnologies import AWG401x_AFG
from pymeasure.instruments.activetechnologies.AWG401x import ChannelAFG, SequenceEntry
def test_AFG_init():
with expected_protocol(
AWG401x_AFG,
... | 2 | assert | numeric_literal | tests/instruments/activetechnologies/test_AWG401x.py | test_AFG_init | 85 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.ptw.ptwDIAMENTOR import ptwDIAMENTOR
from time import sleep
BAUD_RATES = [9600, 19200, 38400, 57600, 115200]
DAP_UNITS = ["cGycm2", "Gycm2", "uGym2", "Rcm2"]
def diamentor(connected_device_address, baud_rate=9600):
instr = ptwDIAMENTOR(connected_device_address, baud_rate=b... | int | assert | variable | tests/instruments/ptw/test_ptwDIAMENTOR_with_device.py | test_measurement | TestPTWDiamentorProperties | 85 | 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")
],
... | 0 | assert | numeric_literal | tests/instruments/lakeshore/test_lakeshore211.py | test_relays | 97 | null | |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley.keithley2510 import Keithley2510
def test_temperature_pid():
with expected_protocol(
Keithley2510,
[
(b":SOURce:TEMPerature:LCONstants:GAIN 1", None),
(b":SOURce:TEMPerature:LCONstants:INTegral ... | (1, 2, 3) | assert | collection | tests/instruments/keithley/test_keithley2510.py | test_temperature_pid | 105 | 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(
... | 3 | assert | numeric_literal | tests/instruments/anritsu/test_anritsuMS464xB.py | test_init_unknown_active_channels | 69 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.ipgphotonics.yar import YAR
init_comm = [("RNP", "RNP: 0.200"), ("RMP", "RMP: 10.5"), ("RDPT", "RDPT: 0.100")]
def test_init_sets_minimum_display_power():
"""Test, that a different minimum power is shown in the translation of '... | 5 | assert | numeric_literal | tests/instruments/ipgphotonics/test_yar.py | test_init_sets_minimum_display_power | 122 | 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... | int | assert | variable | tests/instruments/keysight/test_keysightPNA_with_device.py | test_number_of_points | TestMeasurementChannel | 111 | null |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.kepco import KepcoBOP3612
def test_bop_test_getter():
with expected_protocol(
KepcoBOP3612,
[(b'DIAG:TST?', b'0')],
) as inst:
assert inst.bop_test == | 0 | assert | numeric_literal | tests/instruments/kepco/test_kepcobop.py | test_bop_test_getter | 42 | 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... | len(nf) | assert | func_call | tests/instruments/agilent/test_agilentN8975A_with_device.py | test_noise_figure | TestFixedMode | 126 | null |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.teledyne.teledyne_oscilloscope import sanitize_source
from pymeasure.instruments.teledyne.teledyneMAUI import TeledyneMAUI
from pymeasure.test import expected_protocol
INVALID_CHANNELS = ["INVALID_SOURCE", "C1 C2", "C1 MATH", "C1234567", "CHANNEL"]
VALID_CHANNELS = [('C1', 'C1... | channel[1] | assert | complex_expr | tests/instruments/teledyne/test_teledyneMAUI.py | test_sanitize_valid_source | 69 | null | |
pymeasure/pymeasure | from pymeasure.test import expected_protocol
from pymeasure.instruments.lakeshore import LakeShore425
def test_unit():
# from manual
with expected_protocol(
LakeShore425, [(b"UNIT?", b"1")]) as instr:
assert instr.unit == | "G" | assert | string_literal | tests/instruments/lakeshore/test_lakeshore425.py | test_unit | 40 | 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_next_error(scpi_device):
err = scpi_device.next_error
assert int(err[0]) == | 0 | assert | numeric_literal | tests/instruments/test_scpi_mixin_with_device.py | test_next_error | 61 | 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_discrete_set():
assert truncated_discrete_set(5, range(1... | 6 | assert | numeric_literal | tests/instruments/test_validators.py | test_truncated_discrete_set | 72 | 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... | idn | assert | variable | tests/instruments/siglenttechnologies/test_siglent_sds1000xhd_with_device.py | test_identification | 64 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.ptw.ptwDIAMENTOR import ptwDIAMENTOR
from time import sleep
BAUD_RATES = [9600, 19200, 38400, 57600, 115200]
DAP_UNITS = ["cGycm2", "Gycm2", "uGym2", "Rcm2"]
def diamentor(connected_device_address, baud_rate=9600):
instr = ptwDIAMENTOR(connected_device_address, baud_rate=b... | diamentor.id | assert | complex_expr | tests/instruments/ptw/test_ptwDIAMENTOR_with_device.py | test_id | TestPTWDiamentorProperties | 77 | null |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.agilent.agilent33500 import Agilent33500
@pytest.mark.parametrize("offset", [-4.995, 4.995])
def test_offset(offset):
"""
Test Agilent 33500 offset function
"""
with expected_protocol(
Agilent33500,
[
... | inst.offset | assert | complex_expr | tests/instruments/agilent/test_agilent33500.py | test_offset | 170 | 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... | 0 | assert | numeric_literal | tests/instruments/keithley/test_keithley2306_with_device.py | test_pulse_current_step_delay | TestKeithley2306 | 329 | null |
pymeasure/pymeasure | import pytest
from io import StringIO
from pymeasure.experiment.sequencer import SequenceHandler, SequenceEvaluationError
def non_empty_lines(text):
lines = text.split("\n")
linect = 0
for line in lines:
if line.strip() != "":
linect += 1
return linect
@pytest.mark.parametrize("se... | lev | assert | variable | tests/experiment/test_sequencer.py | test_sequencer | 82 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.instruments.teledyne.teledyne_oscilloscope import sanitize_source
from pymeasure.instruments.lecroy.lecroyT3DSO1204 import LeCroyT3DSO1204
from pymeasure.test import expected_protocol
INVALID_CHANNELS = ["INVALID_SOURCE", "C1 C2", "C1 MATH", "C1234567", "CHANNEL"]
VALID_CHANNELS = [('C1',... | 2 | assert | numeric_literal | tests/instruments/lecroy/test_lecroyT3DSO1204.py | test_download_two_points | 336 | 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_current(self, e5270b):
e5270b.smu1... | 0, abs=1e-3) | pytest.approx | complex_expr | tests/instruments/agilent/test_agilentE5270B_with_device.py | test_current | TestSMU | 89 | 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... | 1 | assert | numeric_literal | tests/instruments/hp/test_hp8116a_with_device.py | test_given_invalid_duty_cycle_when_check_errors_then_error | TestHP8116A | 225 | 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 | string_literal | tests/adapters/test_protocol.py | test_write_and_read_with_and_without_bytes | 240 | 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][0] | assert | complex_expr | tests/instruments/keysight/test_keysightPNA.py | test_y_data_complex_ascii | TestTrace | 220 | 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... | ret | assert | variable | tests/instruments/hp/test_hp8116a_with_device.py | test_given_ask_called_then_return_value_valid | TestHP8116A | 147 | null |
pymeasure/pymeasure | import time
from unittest import mock
from pymeasure.process import context
from pymeasure.log import Scribe, setup_logging
def test_scribe_stop():
q = context.Queue()
s = Scribe(q)
s.start()
assert s.is_alive() is | True | assert | bool_literal | tests/test_log.py | test_scribe_stop | 38 | 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... | len(y) | assert | func_call | tests/instruments/keysight/test_keysightPNA_with_device.py | test_y | TestMarker | 181 | 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... | 1 | assert | numeric_literal | tests/instruments/keysight/test_keysightDSOX1102G_with_device.py | test_ch_offset | TestKeysightDSOX1102G | 152 | 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"... | int | assert | variable | tests/instruments/ptw/test_ptwUNIDOS_with_device.py | test_serial_number | TestPTWUnidosProperties | 119 | null |
pymeasure/pymeasure | import pytest
import serial
from pymeasure.adapters import SerialAdapter, VISAAdapter
from pymeasure.instruments import Instrument
def test_override_interface_specific_defaults():
"""As as user, I want to be able to override interface-specific hardcoded defaults.
"""
instr1 = MultiprotocolInstrument(adapt... | True | assert | bool_literal | tests/instruments/test_connection_configuration.py | test_override_interface_specific_defaults | 197 | null | |
pymeasure/pymeasure | from pymeasure.process import StoppableProcess
def test_process_stopping():
process = StoppableProcess()
process.start()
process.stop()
assert process.should_stop() is | True | assert | bool_literal | tests/test_process.py | test_process_stopping | 32 | null | |
pymeasure/pymeasure | import pytest
from pymeasure.test import expected_protocol
from pymeasure.instruments.keithley import KeithleyDMM6500
def test_current_ac_digits_getter():
with expected_protocol(
KeithleyDMM6500,
[(b'*LANG SCPI', None),
(b':DISP:CURR:AC:DIG?', b'6\n')],
) as inst:
... | 6 | assert | numeric_literal | tests/instruments/keithley/test_keithleyDMM6500.py | test_current_ac_digits_getter | 131 | null | |
pymeasure/pymeasure | import pytest
import serial
from pymeasure.adapters import SerialAdapter, VISAAdapter
from pymeasure.instruments import Instrument
def test_distinct_interface_specific_defaults():
"""As an instrument implementor, I can easily prescribe default settings
that are different between interfaces.
"""
instr1... | '\r' | assert | string_literal | tests/instruments/test_connection_configuration.py | test_distinct_interface_specific_defaults | 179 | 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... | 5 | assert | numeric_literal | tests/instruments/keithley/test_keithley2306_with_device.py | test_current_range | TestKeithley2306 | 214 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.