repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
pytest-dev/pytest-bdd
c5568af6f2b5438646da180df2fb005cd015a7ae
144
train
train
tests/steps/test_common.py
test_step_catches_all
assert
collection
51
import textwrap from typing import Any, Callable from unittest import mock import pytest from pytest_bdd import given, parsers, then, when from pytest_bdd.utils import collect_dumped_objects def test_step_catches_all(testdir): """Test that the @step(...) decorator works for all kind of steps.""" testdir.make...
["foo", ("foo parametrized", 1), "foo", ("foo parametrized", 2), "foo", ("foo parametrized", 3)]
c5568af6f2b5438646da180df2fb005cd015a7ae
144
v2_extractor_at_anchor
pytest-dev/pytest-bdd
c5568af6f2b5438646da180df2fb005cd015a7ae
144
train
train
tests/test_hooks.py
test_hooks
assert
numeric_literal
43
import textwrap def test_hooks(testdir): testdir.makeconftest("") subdir = testdir.mkpydir("subdir") subdir.join("conftest.py").write( textwrap.dedent( r""" def pytest_pyfunc_call(pyfuncitem): print('\npytest_pyfunc_call hook') def pytest_generate_tests(met...
1
c5568af6f2b5438646da180df2fb005cd015a7ae
144
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
src/xdist/dsession.py
pytest_runtestloop
assert
none_literal
91
import py import pytest from xdist.workermanage import NodeManager from xdist.scheduler import ( EachScheduling, LoadScheduling, LoadScopeScheduling, LoadFileScheduling, LoadGroupScheduling, ) from queue import Empty, Queue class DSession: def __init__(self, config): self.config = co...
None
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
src/xdist/remote.py
pytest_runtest_logreport
assert
complex_expr
138
import sys import os import time import py import pytest from execnet.gateway_base import dumps, DumpError from _pytest.config import _prepareconfig, Config def worker_title(title): try: setproctitle(title) except Exception: # changing the process name is very optional, no errors please ...
report.nodeid
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
src/xdist/scheduler/load.py
add_node
assert
complex_expr
71
from itertools import cycle from py.log import Producer from _pytest.runner import CollectReport from xdist.workermanage import parse_spec_config from xdist.report import report_collection_diff class LoadScheduling: def __init__(self, config, log=None): self.numnodes = len(parse_spec_config(config)) ...
self.node2pending
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
src/xdist/scheduler/loadscope.py
add_node
assert
complex_expr
77
from collections import OrderedDict from _pytest.runner import CollectReport from py.log import Producer from xdist.report import report_collection_diff from xdist.workermanage import parse_spec_config class LoadScopeScheduling: def __init__(self, config, log=None): self.numnodes = len(parse_spec_config(...
self.assigned_work
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/acceptance_test.py
test_session_hooks
assert
numeric_literal
42
import os import re import shutil from typing import Dict from typing import List from typing import Tuple import pytest import xdist @pytest.mark.xfail(reason="works if run outside test suite", run=False) def test_session_hooks(pytester: pytest.Pytester) -> None: pytester.makeconftest( """ import...
1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/acceptance_test.py
test_config_initialization
assert
numeric_literal
34
import os import re import shutil from typing import Dict from typing import List from typing import Tuple import pytest import xdist def test_config_initialization( pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch, pytestconfig ) -> None: """Ensure workers and controller are initialized consistentl...
0
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/acceptance_test.py
test_n1_fail_minus_x
assert
numeric_literal
24
import os import re import shutil from typing import Dict from typing import List from typing import Tuple import pytest import xdist class TestDistribution: def test_n1_fail_minus_x(self, pytester: pytest.Pytester) -> None: p1 = pytester.makepyfile( """ def test_fail1(): ...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_default_max_worker_restart
assert
numeric_literal
19
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet def test_default_max_worker_restart() -> None: class config: class option:...
8
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_default_max_worker_restart
assert
numeric_literal
22
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet def test_default_max_worker_restart() -> None: class config: class option:...
1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_default_max_worker_restart
assert
numeric_literal
25
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet def test_default_max_worker_restart() -> None: class config: class option:...
0
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_batch_size
assert
numeric_literal
30
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_batch_size(self, pytester: pytest.Pyt...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_fewer_tests_than_nodes
assert
collection
29
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_fewer_tests_than_nodes(self, pytester...
[]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_load_simple
assert
collection
30
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_load_simple(self, pytester: pytest.Pyt...
[0]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_load_simple
assert
collection
31
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_load_simple(self, pytester: pytest.Pyt...
[1]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_batch_size
assert
collection
33
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_batch_size(self, pytester: pytest.Pyt...
[5]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_fewer_than_two_tests_per_node
assert
collection
31
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_fewer_than_two_tests_per_node( ...
[2]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_report_collection_diff_equal
assert
none_literal
13
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet def test_report_collection_diff_equal() -> None: """Test reporting of equal collec...
None
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_batch_size
assert
variable
28
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_batch_size(self, pytester: pytest.Pyt...
sent1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_batch_size
assert
variable
29
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_batch_size(self, pytester: pytest.Pyt...
sent2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_batch_size
assert
collection
25
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_batch_size(self, pytester: pytest.Pyt...
[0, 2]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_dsession.py
test_schedule_fewer_than_two_tests_per_node
assert
collection
29
from xdist.dsession import DSession, get_default_max_worker_restart from xdist.report import report_collection_diff from xdist.scheduler import EachScheduling, LoadScheduling from typing import Optional import pytest import execnet class TestLoadScheduling: def test_schedule_fewer_than_two_tests_per_node( ...
[0, 3]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_looponfail.py
test_looponfail_from_fail_to_ok
assert
numeric_literal
30
from typing import cast import py import pytest import shutil import textwrap from pathlib import Path from xdist.looponfail import RemoteControl from xdist.looponfail import StatRecorder PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] class TestLoopo...
1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_looponfail.py
test_looponfail_from_one_to_two_tests
assert
numeric_literal
44
from typing import cast import py import pytest import shutil import textwrap from pathlib import Path from xdist.looponfail import RemoteControl from xdist.looponfail import StatRecorder PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] class TestLoopo...
0
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_looponfail.py
test_looponfail_removed_test
assert
numeric_literal
31
from typing import cast import py import pytest import shutil import textwrap from pathlib import Path from xdist.looponfail import RemoteControl from xdist.looponfail import StatRecorder PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] class TestLoopo...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_looponfail.py
test_failure_change
assert
numeric_literal
49
from typing import cast import py import pytest import shutil import textwrap from pathlib import Path from xdist.looponfail import RemoteControl from xdist.looponfail import StatRecorder PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] class TestRemot...
-1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_looponfail.py
test_looponfail_from_one_to_two_tests
assert
complex_expr
29
from typing import cast import py import pytest import shutil import textwrap from pathlib import Path from xdist.looponfail import RemoteControl from xdist.looponfail import StatRecorder PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] class TestLoopo...
remotecontrol.failures[0]
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_dist_incompatibility_messages
assert
numeric_literal
12
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_dist_incompatibility_messages(pytester: pytest.Pytester) -> None: result = pytester.runpytest("--pdb", "--looponfail") assert result.ret !=
0
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_auto_detect_cpus
assert
numeric_literal
31
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_auto_detect_cpus( pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch ) -> None: import os from xdist.plugin import pytest_cmdline_main as check_options wi...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_xspecs_multiplied
assert
numeric_literal
15
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest class TestDistOptions: def test_xspecs_multiplied(self, pytester: pytest.Pytester) -> None: config = pytester.parseconfigure("--tx=3*popen") xspecs = NodeManager(confi...
3
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_auto_detect_cpus
assert
numeric_literal
35
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_auto_detect_cpus( pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch ) -> None: import os from xdist.plugin import pytest_cmdline_main as check_options wi...
99
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_auto_detect_cpus_psutil
assert
numeric_literal
21
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_auto_detect_cpus_psutil( pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch ) -> None: from xdist.plugin import pytest_cmdline_main as check_options psutil = ...
42
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_auto_detect_cpus_psutil
assert
numeric_literal
25
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_auto_detect_cpus_psutil( pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch ) -> None: from xdist.plugin import pytest_cmdline_main as check_options psutil = ...
84
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_testrunuid_generated
assert
numeric_literal
13
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_testrunuid_generated(pytester: pytest.Pytester) -> None: config = pytester.parseconfigure("--tx=popen") nm = NodeManager(config) assert len(nm.testrunuid) ==
32
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_getxspecs
assert
string_literal
18
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest class TestDistOptions: def test_getxspecs(self, pytester: pytest.Pytester) -> None: config = pytester.parseconfigure("--tx=popen", "--tx", "ssh=xyz") nodemanager = Node...
"xyz"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_getrsyncdirs_with_conftest
assert
variable
26
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest class TestDistOptions: def test_getrsyncdirs_with_conftest(self, pytester: pytest.Pytester) -> None: p = Path.cwd() for bn in ("x", "y", "z"): p.joinpath(b...
roots
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_plugin.py
test_dist_options
assert
string_literal
15
from contextlib import suppress from pathlib import Path import execnet from xdist.workermanage import NodeManager import pytest def test_dist_options(pytester: pytest.Pytester) -> None: from xdist.plugin import pytest_cmdline_main as check_options config = pytester.parseconfigure("-n 2") check_options(...
"load"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_remote_env_vars
assert
numeric_literal
37
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
0
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_remote_usage_prog
assert
numeric_literal
54
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_basic_collect_and_runtests
assert
numeric_literal
59
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
3
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_runtests_all
assert
numeric_literal
51
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_process_from_remote_error_handling
assert
variable
43
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
out
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_basic_collect_and_runtests
assert
string_literal
66
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"call"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_basic_collect_and_runtests
assert
complex_expr
68
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
ev.kwargs
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_remoteinitconfig
assert
collection
33
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
(-1, None)
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_process_from_remote_error_handling
assert
string_literal
45
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"errordown"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_basic_collect_and_runtests
assert
string_literal
62
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"testreport"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_runtests_all
assert
string_literal
45
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"workerready"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_remote_collect_skip
assert
string_literal
47
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"collectreport"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_remote.py
test_remote_collect_skip
assert
string_literal
50
import pprint import py import pytest import sys import uuid from xdist.workermanage import WorkerController import execnet import marshal from queue import Queue WAIT_TIMEOUT = 10.0 def check_marshallable(d): try: marshal.dumps(d) except ValueError: pprint.pprint(d) raise ValueError...
"Skipped: hello"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_popen_makegateway_events
assert
numeric_literal
49
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
2
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_rsync_popen_with_path
assert
numeric_literal
53
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
1
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_hrsync_filter
assert
numeric_literal
53
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
3
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_rsync_report
assert
variable
65
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
out
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_popen_no_default_chdir
assert
none_literal
44
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
None
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_popen_makegateway_events
assert
string_literal
53
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
"gw0"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_popen_makegateway_events
assert
string_literal
55
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
"gw1"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_default_chdir
assert
string_literal
48
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
"abc"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_rsync_same_popen_twice
assert
variable
59
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
source
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_rsync_same_popen_twice
assert
complex_expr
61
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
hm.group
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_hrsync_filter
assert
variable
55
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
basenames
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_default_chdir
assert
string_literal
46
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
"pyexecnetcache"
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
pytest-dev/pytest-xdist
6b02b353d235451e18878c515bfae756378041b5
191
train
train
testing/test_workermanage.py
test_popen_makegateway_events
assert
func_call
52
import execnet import py import pytest import shutil import textwrap from pathlib import Path from xdist import workermanage from xdist.workermanage import HostRSync, NodeManager pytest_plugins = "pytester" def hookrecorder(request, config, pytester: pytest.Pytester): hookrecorder = pytester.make_hook_recorder(co...
execnet.XSpec("popen")
6b02b353d235451e18878c515bfae756378041b5
191
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_abc.py
test_abc_implementation
assert
func_call
32
import abc import inspect import pytest import attrs from attr._compat import PY310, PY_3_12_PLUS class TestUpdateAbstractMethods: def test_abc_implementation(self, slots): """ If an attrs class implements an abstract method, it stops being abstract. """ class Ordered(ab...
Concrete(1)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_abc.py
test_remain_abstract
pytest.raises
complex_expr
35
import abc import inspect import pytest import attrs from attr._compat import PY310, PY_3_12_PLUS class TestUpdateAbstractMethods: def test_remain_abstract(self, slots): """ If an attrs class inherits from an abstract class but doesn't implement abstract methods, it remains abstract. ...
TypeError, match=expected_exception_message)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_keyword_only_auto_attribs
assert
numeric_literal
43
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
0
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_keyword_only_auto_attribs
assert
numeric_literal
44
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
1
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_basic_annotations
assert_*
variable
40
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
C)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_auto_attribs_subclassing
assert_*
variable
50
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
A)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_auto_attribs_subclassing
assert_*
variable
51
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
B)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_annotations.py
test_pipe_non_introspectable
assert
collection
30
import sys import types import typing import pytest import attr from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError def assert_init_annotations(cls, **annotations): """ Assert cls.__init__ has the correct annotations. """ __tracebackhide__ = True annotatio...
{}
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_not_implemented_is_propagated
assert
func_call
57
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
C(2)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_not_implemented_is_propagated
assert
func_call
58
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
C(1)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_equal_same_type
assert
func_call
55
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
cls(1)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_unequal_same_type
assert
func_call
55
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
cls(2)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_eq
assert
string_literal
58
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
"__eq__"
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_cmp.py
test_ne
assert
string_literal
61
import pytest from attr._cmp import cmp_using EqCSameType = cmp_using(eq=lambda a, b: a == b, class_name="EqCSameType") PartialOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt=lambda a, b: a < b, class_name="PartialOrderCSameType", ) FullOrderCSameType = cmp_using( eq=lambda a, b: a == b, lt...
"__ne__"
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_compat.py
test_immutable
pytest.raises
complex_expr
27
import types import pytest def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: def test_immutable(self, mp): """ All mutating methods raise errors. """ with pytest.raises(TypeError, match="not support item assignment"): mp["z"]...
AttributeError, match="no attribute 'pop'")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_compat.py
test_immutable
pytest.raises
complex_expr
18
import types import pytest def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: def test_immutable(self, mp): """ All mutating methods raise errors. """ with pytest.raises(TypeError, match="not support item assignment"): mp["z"]...
TypeError, match="not support item deletion")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_compat.py
test_immutable
pytest.raises
complex_expr
24
import types import pytest def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: def test_immutable(self, mp): """ All mutating methods raise errors. """ with pytest.raises(TypeError, match="not support item assignment"): mp["z"]...
AttributeError, match="no attribute 'clear'")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_compat.py
test_immutable
pytest.raises
complex_expr
21
import types import pytest def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: def test_immutable(self, mp): """ All mutating methods raise errors. """ with pytest.raises(TypeError, match="not support item assignment"): mp["z"]...
AttributeError, match="no attribute 'update'")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_compat.py
test_immutable
pytest.raises
complex_expr
15
import types import pytest def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: def test_immutable(self, mp): """ All mutating methods raise errors. """ with pytest.raises(
TypeError, match="not support item assignment")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_config.py
test_wrong_type
pytest.raises
variable
12
import pytest from attr import _config class TestConfig: def test_wrong_type(self): """ Passing anything else than a boolean raises TypeError. """ with pytest.raises(
TypeError)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_config.py
test_wrong_type
assert
complex_expr
14
import pytest from attr import _config class TestConfig: def test_wrong_type(self): """ Passing anything else than a boolean raises TypeError. """ with pytest.raises(TypeError) as e: _config.set_run_validators("False") assert "'run' must be bool." ==
e.value.args[0]
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_config.py
test_default
assert
complex_expr
11
import pytest from attr import _config class TestConfig: def test_default(self): """ Run validators by default. """ assert True is
_config._run_validators
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_config.py
test_get_run_validators
assert
func_call
13
import pytest from attr import _config class TestConfig: def test_get_run_validators(self): """ Returns `_run_validators`. """ _config._run_validators = False assert _config._run_validators is
_config.get_run_validators()
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_success_with_type
assert
numeric_literal
17
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestOptional: def test_success_with_type(self): """ Wrapped converter is used as usual if value is not None. """ c = optional(int) asser...
42
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_success_with_none
assert
none_literal
17
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestOptional: def test_success_with_none(self): """ Nothing happens if None. """ c = optional(int) assert c(None) is
None
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_sugar
assert
complex_expr
22
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestPipe: def test_sugar(self): """ `pipe(c1, c2, c3)` and `[c1, c2, c3]` are equivalent. """ @attr.s class C: a1 = attrib(de...
c.a1
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_not_none
assert
func_call
18
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestDefaultIfNone: @pytest.mark.parametrize("val", [1, 0, True, False, "foo", "", object()]) def test_not_none(self, val): """ If a non-None value is passed, ...
c(val)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_none_value
assert
func_call
17
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestDefaultIfNone: def test_none_value(self): """ Default values are returned when a None is passed. """ c = default_if_none(42) assert ...
c(None)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_success
assert
func_call
16
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestPipe: def test_success(self): """ Succeeds if all wrapped converters succeed. """ c = pipe(str, to_bool, bool) assert True is
c("True")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_empty
assert
func_call
17
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestPipe: def test_empty(self): """ Empty pipe returns same value. """ o = object() assert o is
pipe()(o)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_fail
pytest.raises
variable
17
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestOptional: def test_fail(self): """ Propagates the underlying conversion error when conversion fails. """ c = optional(int) with pyte...
ValueError)
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_factory_takes_self
pytest.raises
complex_expr
15
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestDefaultIfNone: def test_factory_takes_self(self): """ Raises ValueError if passed Factory has takes_self=True. """ with pytest.raises(
ValueError, match="takes_self")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_too_many_defaults
pytest.raises
complex_expr
15
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestDefaultIfNone: def test_too_many_defaults(self): """ Raises TypeError if both default and factory are passed. """ with pytest.raises(
TypeError, match="but not both")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_missing_default
pytest.raises
complex_expr
14
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestDefaultIfNone: def test_missing_default(self): """ Raises TypeError if neither default nor factory have been passed. """ with pytest.raises(
TypeError, match="Must pass either")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_converters.py
test_unhashable
pytest.raises
complex_expr
14
import pytest import attr from attr import Factory, attrib from attr.converters import default_if_none, optional, pipe, to_bool class TestToBool: def test_unhashable(self): """ Fails if value is unhashable. """ with pytest.raises(
ValueError, match="Cannot convert value to bool")
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor
python-attrs/attrs
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
train
train
tests/test_dunders.py
test_hash_mirrors_eq
assert
variable
65
import copy import pickle import pytest from hypothesis import given from hypothesis.strategies import booleans import attr from attr._make import ( NOTHING, Factory, _add_repr, _is_slot_cls, _make_init, fields, make_class, ) from attr.validators import instance_of from .utils import si...
i
724bb9a6ca1570b40e933e8375e267421ae1be3f
303
v2_extractor_at_anchor