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
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_migrate_attribute_name_to_air_tag
assert
string_literal
152
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"id_"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_safestr_behaves_like_str
assert
variable
156
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
value
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_migrate_attribute_name_to_html
assert
string_literal
151
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"class"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_export_pretty_html_uses_console
assert
string_literal
166
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"panel"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_migrate_attribute_name_to_air_tag
assert
string_literal
151
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"class_"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_save_text_writes_content
assert
string_literal
155
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"payload"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_pretty_print_python_outputs_code
assert
collection
160
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
["x = 1"]
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_compact_format_html_minifies_with_safe_defaults
assert
string_literal
162
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"minified"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_migrate_attribute_name_to_html
assert
string_literal
153
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"data-value"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_display_pretty_html_in_the_browser_uses_export
assert
collection
167
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
["exported"]
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_extract_html_comment_with_whitespace
assert
string_literal
151
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"hello world"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_migrate_attribute_name_to_air_tag
assert
string_literal
153
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"_data_value_"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_format_html_uses_lxml_fragment_path
assert
string_literal
153
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
"<span></span>"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_tags_utils.py
test_locals_cleanup_respects_skip_override
assert
collection
158
from __future__ import annotations import sys import types from collections import UserString from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE from full...
{"custom": "x"}
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_templating.py
test_JinjaRenderer
assert
numeric_literal
35
import sys import types import jinja2 import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from jinja2 import FileSystemLoader from starlette.templating import _TemplateResponse import air from air import Air, JinjaRenderer, Request from .components import index as index_callable # py...
200
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_templating.py
test_JinjaRenderer_with_context_processors
assert
none_literal
27
import sys import types import jinja2 import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from jinja2 import FileSystemLoader from starlette.templating import _TemplateResponse import air from air import Air, JinjaRenderer, Request from .components import index as index_callable # py...
None
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_templating.py
test_Renderer_filter_context_with_request
assert
string_literal
34
import sys import types import jinja2 import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from jinja2 import FileSystemLoader from starlette.templating import _TemplateResponse import air from air import Air, JinjaRenderer, Request from .components import index as index_callable # py...
"Test"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_templating.py
test_Renderer_filter_context_with_request
assert
variable
33
import sys import types import jinja2 import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from jinja2 import FileSystemLoader from starlette.templating import _TemplateResponse import air from air import Air, JinjaRenderer, Request from .components import index as index_callable # py...
request
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_utils.py
test_compute_page_path_returns_root_for_index_endpoint
assert
string_literal
6
from air.utils import compute_page_path def test_compute_page_path_returns_root_for_index_endpoint() -> None: actual_path = compute_page_path(endpoint_name="index") assert actual_path ==
"/"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_utils.py
test_compute_page_path_handles_single_word_endpoint
assert
string_literal
6
from air.utils import compute_page_path def test_compute_page_path_handles_single_word_endpoint() -> None: actual_path = compute_page_path(endpoint_name="home") assert actual_path ==
"/home"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_utils.py
test_compute_page_path_with_forward_slash_separator
assert
string_literal
6
from air.utils import compute_page_path def test_compute_page_path_with_forward_slash_separator() -> None: actual_path = compute_page_path(endpoint_name="api_users", separator="/") assert actual_path ==
"/api/users"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
feldroy/air
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
train
train
tests/test_utils.py
test_compute_page_path_handles_multiple_underscores
assert
string_literal
6
from air.utils import compute_page_path def test_compute_page_path_handles_multiple_underscores() -> None: actual_path = compute_page_path(endpoint_name="user_profile_settings") assert actual_path ==
"/user-profile-settings"
33c644b4d1efc142236c3d3a8054ea0b431afb7c
138
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_client.py
test_client_request_flash
assert
collection
15
from __future__ import unicode_literals from threading import Thread from time import sleep from flashfocus.client import client_request_flash def test_client_request_flash(stub_server): p = Thread(target=stub_server.await_data) p.start() client_request_flash() sleep(0.05) p.join() assert st...
[b"1"]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_load_merged_config_with_no_custom_config
assert
numeric_literal
57
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
0.5
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_load_merged_config_with_custom_config
assert
numeric_literal
54
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
0.2
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_hierarchical_merge_returns_a_new_dict
assert
variable
49
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
a_copy
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_dehyphen
assert
variable
55
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
expected
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_rules_added_to_config_dict_if_not_present_in_config
assert
variable
48
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
validated
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
check_validated_config
assert
collection
38
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
[True, False]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_valid_param
assert
func_call
79
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
len(blank_cli_options)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_rule_defaults_inherited_from_global_param
assert
complex_expr
47
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
default_config["flash_opacity"]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
test_load_config
assert
collection
45
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
{"default_opacity": 1, "flash_opacity": 0.5}
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_config.py
check_validated_config
assert
collection
40
from pytest import fixture, mark, raises from pytest_lazyfixture import lazy_fixture from flashfocus.config import ( construct_config_error_msg, dehyphen, hierarchical_merge, load_config, load_merged_config, merge_config_sources, ) from flashfocus.syspaths import get_default_config_file def de...
[isinstance(value, typ) for typ in expected_types[name]]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_flasher.py
test_flash_conflicts_are_restarted
assert
numeric_literal
19
from time import sleep from pytest import approx, mark from test.helpers import change_focus, watching_windows from flashfocus.flasher import Flasher def test_flash_conflicts_are_restarted(flasher, window): with watching_windows([window]) as watchers: flasher.flash(window) sleep(0.05) fl...
1
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_flasher.py
test_compute_flash_series
assert
func_call
34
from time import sleep from pytest import approx, mark from test.helpers import change_focus, watching_windows from flashfocus.flasher import Flasher @mark.parametrize( "flash_opacity,default_opacity,ntimepoints,expected_result", [ # test typical usecase (0.8, 1, 4, [0.8, 0.85, 0.9, 0.95, No...
approx(expected)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_flasher.py
test_flash
assert
func_call
17
from time import sleep from pytest import approx, mark from test.helpers import change_focus, watching_windows from flashfocus.flasher import Flasher def test_flash(flasher, window): change_focus(window) expected_opacity = [None] + flasher.flash_series + [1.0] with watching_windows([window]) as watchers...
approx(expected_opacity[1:], 0.01)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_producer.py
test_that_nonvisible_windows_are_not_queued_by_xhandler
assert
collection
34
import socket from pytest import raises from xcffib.xproto import CreateNotifyEvent from flashfocus.client import client_request_flash from test.helpers import change_focus, producer_running, queue_to_list def test_that_nonvisible_windows_are_not_queued_by_xhandler( xhandler, monkeypatch, windows ): null_fak...
[(windows[0], "new_window")]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_producer.py
test_xhandler_handles_focus_shifts
assert
collection
15
import socket from pytest import raises from xcffib.xproto import CreateNotifyEvent from flashfocus.client import client_request_flash from test.helpers import change_focus, producer_running, queue_to_list def test_xhandler_handles_focus_shifts(xhandler, windows): with producer_running(xhandler): change_...
[(windows[1], "focus_shift"), (windows[0], "focus_shift")]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_producer.py
test_client_monitor_handles_client_requests
assert
collection
15
import socket from pytest import raises from xcffib.xproto import CreateNotifyEvent from flashfocus.client import client_request_flash from test.helpers import change_focus, producer_running, queue_to_list def test_client_monitor_handles_client_requests(client_monitor, windows): with producer_running(client_moni...
[ (windows[0], "client_request"), (windows[0], "client_request"), ]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_rule.py
test_rule_matcher_match
assert
numeric_literal
15
from pytest import lazy_fixture, mark, raises from xcffib.xproto import WindowError from flashfocus.rule import * from test.helpers import switch_desktop, to_regex, WindowSession @mark.parametrize( "matcher", [lazy_fixture("rule_matcher"), lazy_fixture("norule_matcher")] ) def test_rule_matcher_match(matcher, win...
0
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_rule.py
test_rule_matcher_returns_none_if_not_flash_on_focus
assert
none_literal
9
from pytest import lazy_fixture, mark, raises from xcffib.xproto import WindowError from flashfocus.rule import * from test.helpers import switch_desktop, to_regex, WindowSession def test_rule_matcher_returns_none_if_not_flash_on_focus(rule_matcher, window): assert rule_matcher.match(window, "focus_shift") is
None
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_rule.py
test_rule_matching
assert
variable
33
from pytest import lazy_fixture, mark, raises from xcffib.xproto import WindowError from flashfocus.rule import * from test.helpers import switch_desktop, to_regex, WindowSession @mark.parametrize( "id_regex,class_regex,should_match", [ # Id matches exactly, no class (r"window1", None, True), ...
should_match
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_rule.py
test_rule_matcher_match
assert
complex_expr
13
from pytest import lazy_fixture, mark, raises from xcffib.xproto import WindowError from flashfocus.rule import * from test.helpers import switch_desktop, to_regex, WindowSession @mark.parametrize( "matcher", [lazy_fixture("rule_matcher"), lazy_fixture("norule_matcher")] ) def test_rule_matcher_match(matcher, win...
matcher.flashers[0]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_rule.py
test_rule_matcher_no_match_returns_default
assert
complex_expr
10
from pytest import lazy_fixture, mark, raises from xcffib.xproto import WindowError from flashfocus.rule import * from test.helpers import switch_desktop, to_regex, WindowSession def test_rule_matcher_no_match_returns_default(rule_matcher, windows): flasher = rule_matcher.match(windows[1]) assert flasher ==
rule_matcher.flashers[1]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_window_opacity_unset_on_shutdown
assert
func_call
16
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession def test_windo...
approx(1)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_window_opacity_set_to_default_on_startup
assert
func_call
15
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession def test_windo...
approx(0.2)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_window_opacity_set_to_default_on_startup
assert
func_call
16
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession def test_windo...
approx(0.5)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_new_window_opacity_set_to_default
assert
func_call
16
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession def test_new_w...
approx(0.4)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_event_loop
assert
variable
30
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession @mark.parametr...
expected_calls
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_server.py
test_second_consecutive_focus_requests_ignored
assert
collection
16
from time import sleep from pytest import approx, mark from xpybutil.ewmh import get_wm_window_opacity from flashfocus.client import client_request_flash from flashfocus.xutil import count_windows, destroy_window, get_current_desktop from test.helpers import change_focus, server_running, WindowSession def test_secon...
[ call(windows[1], "focus_shift") ]
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_sockets.py
test_init_client_socket_without_server
assert
func_call
9
from pytest import raises from flashfocus.sockets import * def test_init_client_socket_without_server(): with raises(SystemExit) as error: init_client_socket() assert "Error:" in
str(error.value)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_syspaths.py
test_determine_runtime_dir_without_xdg
assert
string_literal
8
import os from flashfocus.syspaths import * def test_determine_runtime_dir_without_xdg(): del os.environ["XDG_RUNTIME_DIR"] assert determine_runtime_dir() ==
"/tmp"
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_syspaths.py
test_determine_runtime_dir_with_xdg
assert
string_literal
8
import os from flashfocus.syspaths import * def test_determine_runtime_dir_with_xdg(): os.environ["XDG_RUNTIME_DIR"] = "/run/user/1000" assert determine_runtime_dir() ==
"/run/user/1000"
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_ui.py
test_opacity_deprecation
assert
numeric_literal
12
from flashfocus.server import FlashServer from flashfocus.ui import init_server def return_opacity(self, *args, **kwargs): return self.matcher.flashers[-1].flash_opacity def test_opacity_deprecation(monkeypatch, blank_cli_options): monkeypatch.setattr(FlashServer, "event_loop", return_opacity) cli_options...
0.5
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_xutil.py
test_set_opacity
assert
func_call
9
from pytest import approx, raises from xpybutil.ewmh import get_wm_window_opacity from flashfocus.xutil import * def test_set_opacity(window): set_opacity(window, 0.5) assert get_wm_window_opacity(window).reply() ==
approx(0.5)
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fennerm/flashfocus
ad807115b5e559dc10407153eef15b3ac83b5d54
35
train
train
test/test_xutil.py
test_get_wm_class
assert
collection
8
from pytest import approx, raises from xpybutil.ewmh import get_wm_window_opacity from flashfocus.xutil import * def test_get_wm_class(window): assert get_wm_class(window) ==
("window1", "Window1")
ad807115b5e559dc10407153eef15b3ac83b5d54
35
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_contrib_diagram.py
test_multi_target_transition_diagram
assert
string_literal
42
from contextlib import contextmanager from unittest import mock import pytest from statemachine.contrib.diagram import DotGraphMachine from statemachine.contrib.diagram import main from statemachine.contrib.diagram import quickchart_write_svg from statemachine.transition import Transition from statemachine import His...
""
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_contrib_diagram.py
test_multi_target_transition_diagram
assert
string_literal
41
from contextlib import contextmanager from unittest import mock import pytest from statemachine.contrib.diagram import DotGraphMachine from statemachine.contrib.diagram import main from statemachine.contrib.diagram import quickchart_write_svg from statemachine.transition import Transition from statemachine import His...
"go"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_name_derived_from_identifier
assert
string_literal
40
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_name_derived_from_identifier(self): class TrafficLightMachine(StateMachine): "A traff...
"go"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_multiple_ids_from_the_same_event_will_be_converted_to_multiple_events
assert
string_literal
34
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_multiple_ids_from_the_same_event_will_be_converted_to_multiple_events(self): class TrafficLightMa...
"Go"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statemachine.py
test_states_getitem
assert
string_literal
21
import warnings import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine from statemachine import exceptions from tests.models import MyModel def test_states_getitem(): """States supports index access.""" class SM(StateMachine): ...
"s1"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statemachine.py
test_states_getitem
assert
string_literal
22
import warnings import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine from statemachine import exceptions from tests.models import MyModel def test_states_getitem(): """States supports index access.""" class SM(StateMachine): ...
"s2"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_of_passing_event_as_parameters
assert
string_literal
40
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_of_passing_event_as_parameters(self): class TrafficLightMachine(StateMachine): "A tra...
"Loop"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_name_derived_from_identifier
assert
string_literal
39
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_name_derived_from_identifier(self): class TrafficLightMachine(StateMachine): "A traff...
"stop"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_multiple_ids_from_the_same_event_will_be_converted_to_multiple_events
assert
string_literal
33
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_multiple_ids_from_the_same_event_will_be_converted_to_multiple_events(self): class TrafficLightMa...
"Stop"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_dispatcher.py
test_retrieve_a_callable_from_a_property_name
assert
string_literal
33
import pytest from statemachine.callbacks import CallbackGroup from statemachine.callbacks import CallbackSpec from statemachine.dispatcher import Listener from statemachine.dispatcher import Listeners from statemachine.dispatcher import resolver_factory_from_objects from statemachine.exceptions import InvalidDefinitio...
"Frodo"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_dispatcher.py
test_retrieve_callable_from_a_property_name_that_should_keep_reference
assert
string_literal
35
import pytest from statemachine.callbacks import CallbackGroup from statemachine.callbacks import CallbackSpec from statemachine.dispatcher import Listener from statemachine.dispatcher import Listeners from statemachine.dispatcher import resolver_factory_from_objects from statemachine.exceptions import InvalidDefinitio...
"Bilbo"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
test_accept_event_instance
assert
string_literal
19
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TestExplicitEvent: def test_accept_event_instance(self): class StartMachine(StateMachine): created = State(initial...
"Start"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_mixins.py
test_mixin_should_instantiate_a_machine
assert
string_literal
10
import pytest from statemachine.mixins import MachineMixin from tests.models import MyModel def test_mixin_should_instantiate_a_machine(campaign_machine): model = MyMixedModel(state="draft") assert isinstance(model.statemachine, campaign_machine) assert model.state ==
"draft"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_scxml_units.py
test_removes_namespace_from_attributes
assert
string_literal
26
import xml.etree.ElementTree as ET from unittest.mock import Mock import pytest from statemachine.io.scxml.actions import Log from statemachine.io.scxml.actions import ParseTime from statemachine.io.scxml.actions import create_action_callable from statemachine.io.scxml.actions import create_datamodel_action_callable f...
"value"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_scxml_units.py
test_str_with_cond
assert
string_literal
23
import xml.etree.ElementTree as ET from unittest.mock import Mock import pytest from statemachine.io.scxml.actions import Log from statemachine.io.scxml.actions import ParseTime from statemachine.io.scxml.actions import create_action_callable from statemachine.io.scxml.actions import create_datamodel_action_callable f...
"x > 0"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_state_callbacks.py
assert_is_green_from_state
assert
string_literal
51
from unittest import mock import pytest def event_mock(): return mock.MagicMock() def traffic_light_machine(event_mock): # noqa: C901 from statemachine import State from statemachine import StateMachine class TrafficLightMachineStateEvents(StateMachine): "A traffic light machine" g...
"green"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_donedata.py
test_donedata_callable_returns_dict
assert
string_literal
34
import pytest from statemachine.exceptions import InvalidDefinition from statemachine import Event from statemachine import State from statemachine import StateChart class TestDoneData: async def test_donedata_callable_returns_dict(self, sm_runner): """Handler receives donedata as kwargs.""" recei...
"frodo"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_callbacks.py
test_decorate_unbounded_function
assert
string_literal
61
from unittest import mock import pytest from statemachine.callbacks import CallbackGroup from statemachine.callbacks import CallbackSpec from statemachine.callbacks import CallbackSpecList from statemachine.callbacks import CallbacksRegistry from statemachine.dispatcher import resolver_factory_from_objects from statem...
"HOBBIT"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_state_callbacks.py
assert_is_yellow_from_state
assert
string_literal
51
from unittest import mock import pytest def event_mock(): return mock.MagicMock() def traffic_light_machine(event_mock): # noqa: C901 from statemachine import State from statemachine import StateMachine class TrafficLightMachineStateEvents(StateMachine): "A traffic light machine" g...
"yellow"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_history.py
test_history_values_dict_populated
assert
string_literal
33
import pytest from statemachine import HistoryState from statemachine import State from statemachine import StateChart class TestHistoryStates: async def test_history_values_dict_populated(self, sm_runner): """sm.history_values[history_id] has saved states after exit.""" class GollumPersonality(...
"gollum"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_error_execution.py
test_error_handler_can_set_machine_attributes
assert
string_literal
36
import pytest from statemachine.exceptions import InvalidDefinition from statemachine import Event from statemachine import State from statemachine import StateChart from statemachine import StateMachine class TestErrorHandlerBehaviorLOTR: def test_error_handler_can_set_machine_attributes(self): """The `...
"flooded"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_state.py
test_name_derived_from_id
assert
string_literal
21
import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine def sm_class(): class SM(StateMachine): pending = State(initial=True) waiting_approval = State() approved = State(final=True) start = pending.to(waitin...
"Pending"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_state.py
test_name_derived_from_id
assert
string_literal
23
import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine def sm_class(): class SM(StateMachine): pending = State(initial=True) waiting_approval = State() approved = State(final=True) start = pending.to(waitin...
"Approved"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_transitions.py
test_statemachine_transition_callback
assert
string_literal
47
import pytest from statemachine.exceptions import InvalidDefinition from statemachine.transition import Transition from statemachine import State from statemachine import StateMachine from .models import MyModel def transition_callback_machine(request): if request.param == "bounded": class ApprovalMachi...
"accepted"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/django_project/workflow/tests.py
test_should_publish
assert
string_literal
32
import pytest from statemachine.exceptions import TransitionNotAllowed from workflow.models import WorkflowSteps from workflow.statemachines import WorfklowStateMachine pytestmark = [ pytest.mark.django_db, ] def Workflow(): from workflow.models import Workflow return Workflow def User(): from djan...
"published"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/scxml/test_microwave.py
test_microwave_scxml
assert
string_literal
35
import pytest from statemachine.io.scxml.processor import SCXMLProcessor from statemachine.state import State from statemachine import StateChart MICROWAVE_SCXML = """ <scxml initial="unplugged"> <state id="unplugged"> <transition event="plug-in" target="plugged-in"/> </state> <state id="plugged-in"> <...
"unplugged"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_multiple_destinations.py
test_should_change_to_returned_state_on_multiple_target_with_combined_transitions
assert
string_literal
48
import pytest from statemachine import State from statemachine import StateMachine from statemachine import exceptions def test_should_change_to_returned_state_on_multiple_target_with_combined_transitions(): class ApprovalMachine(StateMachine): "A workflow" requested = State(initial=True) ...
"congrats!"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_compound.py
test_compound_state_name_attribute
assert
string_literal
17
import pytest from statemachine import State from statemachine import StateChart class TestCompoundStates: def test_compound_state_name_attribute(self): """The name= kwarg in class syntax sets the state name.""" class NamedCompound(StateChart): class shire(State.Compound, name="The S...
"The Shire"
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_contrib_diagram.py
test_compound_state_diagram
assert
variable
40
from contextlib import contextmanager from unittest import mock import pytest from statemachine.contrib.diagram import DotGraphMachine from statemachine.contrib.diagram import main from statemachine.contrib.diagram import quickchart_write_svg from statemachine.transition import Transition from statemachine import His...
dot
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_eventless.py
test_eventless_with_in_condition
assert
variable
35
import pytest from statemachine import State from statemachine import StateChart class TestEventlessTransitions: async def test_eventless_with_in_condition(self, sm_runner): """Eventless transition guarded by In('state_id').""" class CoordinatedAdvance(StateChart): validate_disconnec...
vals
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_in_condition.py
test_in_condition_true_enables_transition
assert
variable
31
import pytest from statemachine import State from statemachine import StateChart class TestInCondition: async def test_in_condition_true_enables_transition(self, sm_runner): """In('state_id') when state is active -> transition fires.""" class Fellowship(StateChart): validate_disconnec...
vals
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_parallel.py
test_parallel_activates_all_regions
assert
variable
40
import pytest from statemachine import State from statemachine import StateChart class TestParallelStates: def war_of_the_ring_cls(self): class WarOfTheRing(StateChart): validate_disconnected_states = False class war(State.Parallel): class frodos_quest(State.Compo...
vals
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_events.py
on_cycle
assert
variable
16
import pytest from statemachine.event import Event from statemachine.exceptions import InvalidDefinition from statemachine import State from statemachine import StateMachine class TrafficLightMachine(StateMachine): green = State(initial=True) yellow = State() red = State() def on...
event
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_multiple_destinations.py
test_transition_should_choose_final_state_on_multiple_possibilities
assert
variable
18
import pytest from statemachine import State from statemachine import StateMachine from statemachine import exceptions def test_transition_should_choose_final_state_on_multiple_possibilities( approval_machine, current_time ): # given model = Request() machine = approval_machine(model) model._is_o...
model
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statemachine.py
test_model_with_custom_bool_is_not_replaced
assert
variable
20
import warnings import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine from statemachine import exceptions from tests.models import MyModel def test_model_with_custom_bool_is_not_replaced(campaign_machine): class FalseyModel(MyModel): ...
model
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statemachine.py
test_current_state_with_list_value
assert
variable
26
import warnings import pytest from statemachine.orderedset import OrderedSet from statemachine import State from statemachine import StateMachine from statemachine import exceptions from tests.models import MyModel def test_current_state_with_list_value(): """current_state (deprecated) handles list current_state...
config
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_rtc.py
test_should_preserve_event_order
assert
variable
148
import inspect from unittest import mock import pytest from statemachine import State from statemachine import StateMachine def chained_after_sm_class(): # noqa: C901 class ChainedSM(StateMachine): a = State(initial=True) b = State() c = State(final=True) t1 = a.to(b, after="t1"...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_signature.py
test_wrap_fn_single_positional_parameter
assert
variable
140
import inspect from functools import partial import pytest from statemachine.dispatcher import callable_method from statemachine.signature import SignatureAdapter def single_positional_param(a): return a def single_default_keyword_param(a=42): return a def args_param(*args): return args def kwargs_para...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_signature_positional_only.py
test_positional_only
assert
variable
33
import inspect import pytest from statemachine.dispatcher import callable_method class TestSignatureAdapter: @pytest.mark.parametrize( ("args", "kwargs", "expected"), [ ([], {}, TypeError), ([1, 2, 3], {}, TypeError), ([1, 2], {"kw_only_param": 42}, (1, 2, 42)),...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_spec_parser.py
test_expressions
assert
variable
177
import asyncio import logging import pytest from statemachine.spec_parser import Functions from statemachine.spec_parser import operator_mapping from statemachine.spec_parser import parse_boolean_expr logger = logging.getLogger(__name__) DEBUG = logging.DEBUG def variable_hook(var_name): values = { "frod...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_state_callbacks.py
test_should_call_on_enter_of_specific_state
assert_*
variable
53
from unittest import mock import pytest def event_mock(): return mock.MagicMock() def traffic_light_machine(event_mock): # noqa: C901 from statemachine import State from statemachine import StateMachine class TrafficLightMachineStateEvents(StateMachine): "A traffic light machine" g...
machine)
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statechart_parallel.py
test_current_state_value_set_comparison
assert
variable
49
import pytest from statemachine import State from statemachine import StateChart class TestParallelStates: def war_of_the_ring_cls(self): class WarOfTheRing(StateChart): validate_disconnected_states = False class war(State.Parallel): class frodos_quest(State.Compo...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_statemachine_inheritance.py
test_should_inherit_states_and_transitions
assert
variable
64
import pytest from statemachine import exceptions def BaseMachine(): from statemachine import State from statemachine import StateMachine class BaseMachine(StateMachine, strict_states=False): state_1 = State(initial=True) state_2 = State() trans_1_2 = state_1.to(state_2) t...
expected
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor
fgmacedo/python-statemachine
08dd542b28f895688f877e037a5a3d52f16b0215
109
train
train
tests/test_io.py
test_transition_with_both_parent_and_own_event_name
assert
variable
25
from statemachine.io import _parse_history from statemachine.io import create_machine_class_from_definition class TestCreateMachineWithEventNameConcat: def test_transition_with_both_parent_and_own_event_name(self): """Transition inside 'on' dict that also has its own 'event' key concatenates names.""" ...
event_ids
08dd542b28f895688f877e037a5a3d52f16b0215
109
v2_extractor_at_anchor