repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
hyprland-community/pyprland | import json
import warnings
from http.client import HTTPResponse
from io import BytesIO
from unittest.mock import MagicMock, patch
from urllib.error import HTTPError, URLError
import pytest
from pyprland.httpclient import (
FallbackClientError,
FallbackClientSession,
FallbackClientTimeout,
FallbackResp... | "value" | assert | string_literal | tests/test_http.py | test_get_with_headers | TestFallbackClientSession | 150 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.layout import (
MAX_CYCLE_PATH_LENGTH,
MONITOR_PROPS,
build_graph,
compute_positions,
compute_xy,
find_cycle_path,
get_dims,
)
def make_monitor(name, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor d... | [] | assert | collection | tests/test_monitors_layout.py | test_basic_graph | TestBuildGraph | 222 | null |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.shortcuts_menu import Extension
from pyprland.config import Configuration
from tests.conftest import make_extension
def extension(test_logger):
return make_extension(
Extension,
logger=test_logger,
config={
... | 0 | assert | numeric_literal | tests/test_plugin_shortcuts_menu.py | test_run_menu_with_skip_single | 90 | null | |
hyprland-community/pyprland | from pyprland.models import VersionInfo
def test_version_info_compare_major():
v1 = VersionInfo(1, 0, 0)
v2 = VersionInfo(0, 9, 9)
assert v1 > v2
assert v2 < | v1 | assert | variable | tests/test_common_types.py | test_version_info_compare_major | 22 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.layout_center import Extension
from tests.conftest import make_extension
def extension():
return make_extension(
Extension,
state_active_window="0x1",
config={"margin": 50, "offset": "10 20"},
notify_error=Async... | "0x3" | assert | string_literal | tests/test_plugin_layout_center.py | test_change_focus_prev_wrap | 80 | null | |
hyprland-community/pyprland | from pathlib import Path
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.menubar import get_pid_from_layers_hyprland, is_bar_in_layers_niri, is_bar_alive, Extension
from tests.conftest import make_extension
def extension():
# menubar needs state to be a Mock because it accesse... | "HDMI-A-1" | assert | string_literal | tests/test_plugin_menubar.py | test_get_best_monitor_hyprland | 125 | null | |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_clear(tmp_path):
"""clear() removes all cached files."""
cache = ImageCache(cache_dir=tmp_path)
(tmp_path / "a.jpg").write_bytes(b"a")
(tmp_path / "b.jpg").write_bytes(b"b")
(tmp_path / "c... | 3 | assert | numeric_literal | tests/test_wallpapers_cache.py | test_cache_clear | 226 | null | |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | 16 | assert | numeric_literal | tests/test_wallpapers_imageutils.py | test_rounded_image_manager_paths | 112 | null | |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | False | assert | bool_literal | tests/test_ipc.py | test_hyprland_backend_execute_failure | 95 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestBuildNiriTransformAction:
def test_transform_1(self):
... | "90" | assert | string_literal | tests/test_monitors_commands.py | test_transform_1 | TestBuildNiriTransformAction | 189 | null |
hyprland-community/pyprland | import pytest
from pyprland.commands.discovery import extract_commands_from_object, get_client_commands
from pyprland.commands.models import CommandArg, CommandInfo
from pyprland.commands.parsing import parse_docstring
class TestParseDocstring:
def test_mixed_args(self):
"""Test parsing mixed required an... | 2 | assert | numeric_literal | tests/test_command_registry.py | test_mixed_args | TestParseDocstring | 33 | null |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, call
from pyprland.plugins.shift_monitors import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
ext.monitors = ["M1", "M2", "M3"]
ext.state.environment = "hyprland" # Default to hyprland for existing tests... | ["M1", "M2", "M3", "M4"] | assert | collection | tests/test_plugin_shift_monitors.py | test_monitor_events | 52 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.fetch_client_menu import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(
Extension,
config={"separator": "|", "center_on_fetch": True, "margin": 60},
menu=AsyncMock(),
... | options | assert | variable | tests/test_plugin_fetch_client_menu.py | test_run_fetch_client_menu | 55 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.lost_windows import Extension, contains
from tests.conftest import make_extension
def extension():
return make_extension(Extension)
@pytest.mark.asyncio
async def test_run_attract_lost(extension):
monitor = {"id": 1, "name": "DP-1", "width": 1920, "height": 1080, "x": 0, "y... | 2 | assert | numeric_literal | tests/test_plugin_lost_windows.py | test_run_attract_lost | 48 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.shortcuts_menu import Extension
from pyprland.config import Configuration
from tests.conftest import make_extension
def extension(test_logger):
return make_extension(
Extension,
logger=test_logger,
config={
... | 2 | assert | numeric_literal | tests/test_plugin_shortcuts_menu.py | test_run_menu_nested | 55 | null | |
hyprland-community/pyprland | import pytest
from pytest_asyncio import fixture
from .conftest import mocks
from .testtools import wait_called
async def magnify_config(monkeypatch):
d = {"pyprland": {"plugins": ["magnify"]}, "magnify": {"factor": 2.0}}
monkeypatch.setattr("tomllib.load", lambda x: d)
yield
@pytest.mark.asyncio
async d... | cmd | assert | variable | tests/test_plugin_magnify.py | test_magnify | 25 | null | |
hyprland-community/pyprland | import json
import warnings
from http.client import HTTPResponse
from io import BytesIO
from unittest.mock import MagicMock, patch
from urllib.error import HTTPError, URLError
import pytest
from pyprland.httpclient import (
FallbackClientError,
FallbackClientSession,
FallbackClientTimeout,
FallbackResp... | request.full_url | assert | complex_expr | tests/test_http.py | test_get_with_params | TestFallbackClientSession | 133 | null |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, call
from pyprland.plugins.shift_monitors import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
ext.monitors = ["M1", "M2", "M3"]
ext.state.environment = "hyprland" # Default to hyprland for existing tests... | [call("swapactiveworkspaces M3 M2"), call("swapactiveworkspaces M2 M1")]) | assert_* | collection | tests/test_plugin_shift_monitors.py | test_shift_positive | 35 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_constants():
"""Test that ANSI constants have expected values."""
ass... | "1" | assert | string_literal | tests/test_ansi.py | test_constants | 90 | null | |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | True | assert | bool_literal | tests/test_ipc.py | test_hyprland_backend_execute_success | 81 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.layout_center import Extension
from tests.conftest import make_extension
def extension():
return make_extension(
Extension,
state_active_window="0x1",
config={"margin": 50, "offset": "10 20"},
notify_error=Async... | "0x2") | assert_* | string_literal | tests/test_plugin_layout_center.py | test_change_focus_next | 66 | null | |
hyprland-community/pyprland | import asyncio
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers import Extension, OnlineState
from pyprland.plugins.wallpapers.models import Theme
from pyprland.plugins.wallpapers.online import OnlineFetcher
from tests.conftest import make_extens... | None | assert | none_literal | tests/test_plugin_wallpapers.py | test_run_palette_terminal | 132 | null | |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | 0 | assert | numeric_literal | tests/test_wallpapers_imageutils.py | test_get_variant_color | 90 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_make_style():
"""Test make_style returns correct prefix and suffix."""
... | RESET | assert | variable | tests/test_ansi.py | test_make_style | 43 | null | |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | clients[0] | assert | complex_expr | tests/test_ipc.py | test_backend_get_client_props | 131 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, patch, AsyncMock, MagicMock
import asyncio
import sys
import os
import tempfile
from pathlib import Path
from pyprland.command import Pyprland
from pyprland.models import ExitCode, PyprError
from pyprland.validate_cli import run_validate, _load_plugin_module
def pyprland_a... | True) | assert_* | bool_literal | tests/test_command.py | test_load_config_toml | 54 | null | |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | call_args | assert | variable | tests/test_ipc.py | test_hyprland_backend_execute_batch | 113 | null | |
hyprland-community/pyprland | import pytest
from pyprland.commands.discovery import extract_commands_from_object, get_client_commands
from pyprland.commands.models import CommandArg, CommandInfo
from pyprland.commands.parsing import parse_docstring
class TestParseDocstring:
def test_required_arg(self):
"""Test parsing a required argu... | 1 | assert | numeric_literal | tests/test_command_registry.py | test_required_arg | TestParseDocstring | 16 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestBuildNiriTransformAction:
def test_transform_out_of_range(s... | "99" | assert | string_literal | tests/test_monitors_commands.py | test_transform_out_of_range | TestBuildNiriTransformAction | 207 | null |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, patch, AsyncMock, MagicMock
import asyncio
import sys
import os
import tempfile
from pathlib import Path
from pyprland.command import Pyprland
from pyprland.models import ExitCode, PyprError
from pyprland.validate_cli import run_validate, _load_plugin_module
def pyprland_a... | msg | assert | variable | tests/test_command.py | test_call_handler_unknown_command | 245 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock
from pyprland.plugins.expose import Extension
from tests.conftest import make_extension
def sample_clients():
return [
{"address": "0x1", "workspace": {"id": 1, "name": "1"}, "class": "App1"},
{"address": "0x2", "workspace": {"id": 2, "name": "2"}, "clas... | [] | assert | collection | tests/test_plugin_expose.py | test_run_expose_disable | 73 | null | |
hyprland-community/pyprland | import pytest
from pyprland.commands.discovery import extract_commands_from_object, get_client_commands
from pyprland.commands.models import CommandArg, CommandInfo
from pyprland.commands.parsing import parse_docstring
class TestParseDocstring:
def test_no_args(self):
"""Test parsing docstring with no ar... | [] | assert | collection | tests/test_command_registry.py | test_no_args | TestParseDocstring | 43 | null |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_constants():
"""Test that ANSI constants have expected values."""
ass... | "31" | assert | string_literal | tests/test_ansi.py | test_constants | 92 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, patch, AsyncMock, MagicMock
import asyncio
import sys
import os
import tempfile
from pathlib import Path
from pyprland.command import Pyprland
from pyprland.models import ExitCode, PyprError
from pyprland.validate_cli import run_validate, _load_plugin_module
def pyprland_a... | mock_json | assert | variable | tests/test_command.py | test_load_config_json_fallback | 116 | null | |
hyprland-community/pyprland | import pytest
from pyprland.commands.discovery import extract_commands_from_object, get_client_commands
from pyprland.commands.models import CommandArg, CommandInfo
from pyprland.commands.parsing import parse_docstring
class TestParseDocstring:
def test_empty_docstring(self):
"""Test parsing empty docstr... | "" | assert | string_literal | tests/test_command_registry.py | test_empty_docstring | TestParseDocstring | 60 | null |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, patch, AsyncMock, MagicMock
import asyncio
import sys
import os
import tempfile
from pathlib import Path
from pyprland.command import Pyprland
from pyprland.models import ExitCode, PyprError
from pyprland.validate_cli import run_validate, _load_plugin_module
def pyprland_a... | None | assert | none_literal | tests/test_command.py | test_load_plugin_module_builtin | 344 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.resolution import (
get_monitor_by_pattern,
resolve_placement_config,
)
def make_monitor(name, description=None, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor dict."""
return {
"name": name,
"descr... | "DP-1" | assert | string_literal | tests/test_monitors_resolution.py | test_match_by_name | TestGetMonitorByPattern | 41 | null |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_hash_key(tmp_path):
"""_hash_key() generates consistent short hashes."""
cache = ImageCache(cache_dir=tmp_path)
# Same key should produce same hash
hash1 = cache._hash_key("test-key")
hash... | 32 | assert | numeric_literal | tests/test_wallpapers_cache.py | test_cache_hash_key | 253 | null | |
hyprland-community/pyprland | from typing import cast
from unittest.mock import AsyncMock, Mock
import pytest
import tomllib
from .conftest import mocks as tst
from .testtools import wait_called
from pyprland.manager import Pyprland
@pytest.mark.usefixtures("sample1_config", "server_fixture")
@pytest.mark.asyncio
async def test_reload(monkeypat... | cfg["placement"] | assert | complex_expr | tests/test_pyprland.py | test_reload | 42 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock
from pyprland.plugins.expose import Extension
from tests.conftest import make_extension
def sample_clients():
return [
{"address": "0x1", "workspace": {"id": 1, "name": "1"}, "class": "App1"},
{"address": "0x2", "workspace": {"id": 2, "name": "2"}, "clas... | 1 | assert | numeric_literal | tests/test_plugin_expose.py | test_run_expose_empty_workspace | 101 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.shortcuts_menu import Extension
from pyprland.config import Configuration
from tests.conftest import make_extension
def extension(test_logger):
return make_extension(
Extension,
logger=test_logger,
config={
... | {}) | assert_* | collection | tests/test_plugin_shortcuts_menu.py | test_run_menu_nested | 56 | null | |
hyprland-community/pyprland | import asyncio
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers import Extension, OnlineState
from pyprland.plugins.wallpapers.models import Theme
from pyprland.plugins.wallpapers.online import OnlineFetcher
from tests.conftest import make_extens... | 2 | assert | numeric_literal | tests/test_plugin_wallpapers.py | test_on_reload | 44 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, call
from pyprland.plugins.shift_monitors import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
ext.monitors = ["M1", "M2", "M3"]
ext.state.environment = "hyprland" # Default to hyprland for existing tests... | ["A", "B"] | assert | collection | tests/test_plugin_shift_monitors.py | test_init | 23 | null | |
hyprland-community/pyprland | import asyncio
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers import Extension, OnlineState
from pyprland.plugins.wallpapers.models import Theme
from pyprland.plugins.wallpapers.online import OnlineFetcher
from tests.conftest import make_extens... | palette | assert | variable | tests/test_plugin_wallpapers.py | test_material_palette_generation | 112 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_log_styles():
"""Test LogStyles contains expected style tuples."""
as... | (RED, BOLD) | assert | collection | tests/test_ansi.py | test_log_styles | 78 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, call
from pyprland.plugins.shift_monitors import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
ext.monitors = ["M1", "M2", "M3"]
ext.state.environment = "hyprland" # Default to hyprland for existing tests... | ["M2", "M3", "M4"] | assert | collection | tests/test_plugin_shift_monitors.py | test_monitor_events | 55 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_make_style_no_codes():
"""Test make_style with no codes returns empty pre... | "" | assert | string_literal | tests/test_ansi.py | test_make_style_no_codes | 49 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, patch, AsyncMock, MagicMock
import asyncio
import sys
import os
import tempfile
from pathlib import Path
from pyprland.command import Pyprland
from pyprland.models import ExitCode, PyprError
from pyprland.validate_cli import run_validate, _load_plugin_module
def pyprland_a... | True | assert | bool_literal | tests/test_command.py | test_call_handler_dispatch | 188 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.resolution import (
get_monitor_by_pattern,
resolve_placement_config,
)
def make_monitor(name, description=None, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor dict."""
return {
"name": name,
"descr... | cache | assert | variable | tests/test_monitors_resolution.py | test_cache_populated | TestGetMonitorByPattern | 94 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestNiriTransformNames:
def test_length(self):
"""Test ... | 8 | assert | numeric_literal | tests/test_monitors_commands.py | test_length | TestNiriTransformNames | 225 | null |
hyprland-community/pyprland | import asyncio
import pytest
from pyprland.process import ManagedProcess, SupervisedProcess
class TestSupervisedProcess:
@pytest.mark.asyncio
async def test_auto_restart(self):
"""Test that process auto-restarts on crash."""
restart_count = 0
async def on_crash(proc: SupervisedProce... | 2 | assert | numeric_literal | tests/test_process.py | test_auto_restart | TestSupervisedProcess | 204 | null |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | "#0000ff" | assert | string_literal | tests/test_wallpapers_imageutils.py | test_color_conversions | 79 | null | |
hyprland-community/pyprland | import pytest
import math
from unittest.mock import Mock, patch, MagicMock
from pyprland.plugins.wallpapers.colorutils import (
_build_hue_histogram,
_smooth_histogram,
_find_peaks,
_get_best_pixel_for_hue,
_calculate_hue_diff,
_select_colors_from_peaks,
get_dominant_colors,
nicify_oklab... | 2 | assert | numeric_literal | tests/test_wallpapers_colors.py | test_find_peaks | 93 | null | |
hyprland-community/pyprland | import sys
import pytest
import tomllib
from pytest_asyncio import fixture
from .conftest import mocks as tst
sys.path.append("sample_extension")
async def external_plugin_config(monkeypatch):
"""External config."""
config = """
[pyprland]
plugins = ["pypr_examples.focus_counter"]
"""
monkeypatch.setatt... | call_args | assert | variable | tests/test_external_plugins.py | test_ext_plugin | 32 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, call
from pyprland.plugins.shift_monitors import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
ext.monitors = ["M1", "M2", "M3"]
ext.state.environment = "hyprland" # Default to hyprland for existing tests... | [call("swapactiveworkspaces M1 M2"), call("swapactiveworkspaces M2 M3")]) | assert_* | collection | tests/test_plugin_shift_monitors.py | test_shift_negative | 46 | null | |
hyprland-community/pyprland | import json
import warnings
from http.client import HTTPResponse
from io import BytesIO
from unittest.mock import MagicMock, patch
from urllib.error import HTTPError, URLError
import pytest
from pyprland.httpclient import (
FallbackClientError,
FallbackClientSession,
FallbackClientTimeout,
FallbackResp... | data | assert | variable | tests/test_http.py | test_json | TestFallbackResponse | 59 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestBuildNiriPositionAction:
def test_zero_position(self):
... | 0 | assert | numeric_literal | tests/test_monitors_commands.py | test_zero_position | TestBuildNiriPositionAction | 145 | null |
hyprland-community/pyprland | import pytest
from pyprland.common import merge, apply_filter, is_rotated
def test_apply_filter_substitute_global():
assert apply_filter("foo bar foo", "s/foo/baz/g") == | "baz bar baz" | assert | string_literal | tests/test_common_utils.py | test_apply_filter_substitute_global | 36 | null | |
hyprland-community/pyprland | import pytest
from pyprland.common import merge, apply_filter, is_rotated
def test_is_rotated():
assert is_rotated({"transform": 1}) is | True | assert | bool_literal | tests/test_common_utils.py | test_is_rotated | 47 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestNiriTransformNames:
def test_values(self):
"""Test ... | "Normal" | assert | string_literal | tests/test_monitors_commands.py | test_values | TestNiriTransformNames | 229 | null |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_get_path(tmp_path):
"""get_path() returns deterministic path for key."""
cache = ImageCache(cache_dir=tmp_path)
path1 = cache.get_path("test-key", "jpg")
path2 = cache.get_path("test-key", "jpg... | path2 | assert | variable | tests/test_wallpapers_cache.py | test_cache_get_path | 16 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock
from pyprland.plugins.expose import Extension
from tests.conftest import make_extension
def sample_clients():
return [
{"address": "0x1", "workspace": {"id": 1, "name": "1"}, "class": "App1"},
{"address": "0x2", "workspace": {"id": 2, "name": "2"}, "clas... | 3 | assert | numeric_literal | tests/test_plugin_expose.py | test_exposed_clients_filtering | 35 | null | |
hyprland-community/pyprland | import pytest
import math
from unittest.mock import Mock, patch, MagicMock
from pyprland.plugins.wallpapers.colorutils import (
_build_hue_histogram,
_smooth_histogram,
_find_peaks,
_get_best_pixel_for_hue,
_calculate_hue_diff,
_select_colors_from_peaks,
get_dominant_colors,
nicify_oklab... | 3 | assert | numeric_literal | tests/test_wallpapers_colors.py | test_select_colors_from_peaks | 150 | null | |
hyprland-community/pyprland | import pytest
import math
from unittest.mock import Mock, patch, MagicMock
from pyprland.plugins.wallpapers.colorutils import (
_build_hue_histogram,
_smooth_histogram,
_find_peaks,
_get_best_pixel_for_hue,
_calculate_hue_diff,
_select_colors_from_peaks,
get_dominant_colors,
nicify_oklab... | 10 | assert | numeric_literal | tests/test_wallpapers_colors.py | test_calculate_hue_diff | 100 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.layout_center import Extension
from tests.conftest import make_extension
def extension():
return make_extension(
Extension,
state_active_window="0x1",
config={"margin": 50, "offset": "10 20"},
notify_error=Async... | "0x3") | assert_* | string_literal | tests/test_plugin_layout_center.py | test_change_focus_prev_wrap | 81 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.commands import (
NIRI_TRANSFORM_NAMES,
build_hyprland_command,
build_niri_disable_action,
build_niri_position_action,
build_niri_scale_action,
build_niri_transform_action,
)
class TestBuildNiriTransformAction:
def test_transform_4(self):
... | "Flipped" | assert | string_literal | tests/test_monitors_commands.py | test_transform_4 | TestBuildNiriTransformAction | 195 | null |
hyprland-community/pyprland | import json
import warnings
from http.client import HTTPResponse
from io import BytesIO
from unittest.mock import MagicMock, patch
from urllib.error import HTTPError, URLError
import pytest
from pyprland.httpclient import (
FallbackClientError,
FallbackClientSession,
FallbackClientTimeout,
FallbackResp... | {"result": "ok"} | assert | collection | tests/test_http.py | test_get_simple | TestFallbackClientSession | 118 | null |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | writer | assert | variable | tests/test_ipc.py | test_hyprctl_connection_context_manager | 40 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.shortcuts_menu import Extension
from pyprland.config import Configuration
from tests.conftest import make_extension
def extension(test_logger):
return make_extension(
Extension,
logger=test_logger,
config={
... | 1 | assert | numeric_literal | tests/test_plugin_shortcuts_menu.py | test_run_menu_cancellation | 66 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import AsyncMock
from pyprland.plugins.toggle_dpms import Extension
from tests.conftest import make_extension
def extension():
ext = make_extension(Extension)
# Mocking monitor list
ext.backend.get_monitors = AsyncMock(return_value=[{"name": "DP-1", "dpmsStatus": True}, {"... | "dpms off") | assert_* | string_literal | tests/test_plugin_toggle_dpms.py | test_run_toggle_dpms_off | 20 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_log_styles():
"""Test LogStyles contains expected style tuples."""
as... | (RED, DIM) | assert | collection | tests/test_ansi.py | test_log_styles | 77 | null | |
hyprland-community/pyprland | import pytest
from pyprland.common import merge, apply_filter, is_rotated
def test_apply_filter_substitute():
assert apply_filter("hello world", "s/world/there/") == | "hello there" | assert | string_literal | tests/test_common_utils.py | test_apply_filter_substitute | 31 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_should_colorize_respects_force_color():
"""Test that FORCE_COLOR environm... | True | assert | bool_literal | tests/test_ansi.py | test_should_colorize_respects_force_color | 64 | null | |
hyprland-community/pyprland | from pyprland.config import Configuration
from pyprland.validation import ConfigField, ConfigValidator, _find_similar_key, format_config_error
def test_config_access(test_logger):
conf = Configuration({"a": 1, "b": "test"}, logger=test_logger)
assert conf["a"] == 1
assert conf.get("b") == "test"
asser... | 3 | assert | numeric_literal | tests/test_config.py | test_config_access | 9 | null | |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_get_hit(tmp_path):
"""get() returns path for valid cached file."""
cache = ImageCache(cache_dir=tmp_path)
path = cache.get_path("key", "jpg")
path.write_bytes(b"data")
assert cache.get("ke... | path | assert | variable | tests/test_wallpapers_cache.py | test_cache_get_hit | 66 | null | |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_hash_key(tmp_path):
"""_hash_key() generates consistent short hashes."""
cache = ImageCache(cache_dir=tmp_path)
# Same key should produce same hash
hash1 = cache._hash_key("test-key")
hash... | hash3 | assert | variable | tests/test_wallpapers_cache.py | test_cache_hash_key | 250 | null | |
hyprland-community/pyprland | import pytest
import pytest_asyncio
import asyncio
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.system_notifier import Extension, builtin_parsers
from tests.conftest import make_extension
async def extension():
ext = make_extension(
Extension,
config={"parsers": {}, "sourc... | {} | assert | collection | tests/test_plugin_system_notifier.py | test_initialization | 22 | null | |
hyprland-community/pyprland | import asyncio
import json
import logging
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland import ipc
from pyprland.models import PyprError
from pyprland.adapters.hyprland import HyprlandBackend
def mock_open_connection(mocker):
reader = AsyncMock()
# StreamWriter methods write and ... | clients[1] | assert | complex_expr | tests/test_ipc.py | test_backend_get_client_props | 135 | null | |
hyprland-community/pyprland | import pytest
import math
from unittest.mock import Mock, patch, MagicMock
from pyprland.plugins.wallpapers.colorutils import (
_build_hue_histogram,
_smooth_histogram,
_find_peaks,
_get_best_pixel_for_hue,
_calculate_hue_diff,
_select_colors_from_peaks,
get_dominant_colors,
nicify_oklab... | 7 | assert | numeric_literal | tests/test_wallpapers_colors.py | test_generate_sample_palette | 456 | null | |
hyprland-community/pyprland | from pyprland.config import Configuration
from pyprland.validation import ConfigField, ConfigValidator, _find_similar_key, format_config_error
def test_get_int(test_logger):
conf = Configuration({"a": 1, "b": "2", "c": "invalid"}, logger=test_logger)
assert conf.get_int("a") == 1
assert conf.get_int("b") =... | 5 | assert | numeric_literal | tests/test_config.py | test_get_int | 58 | null | |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | str(path) | assert | func_call | tests/test_wallpapers_imageutils.py | test_rounded_image_manager_paths | 121 | null | |
hyprland-community/pyprland | import pytest
import pytest_asyncio
import asyncio
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.system_notifier import Extension, builtin_parsers
from tests.conftest import make_extension
async def extension():
ext = make_extension(
Extension,
config={"parsers": {}, "sourc... | extension.parsers | assert | complex_expr | tests/test_plugin_system_notifier.py | test_on_reload_builtin_parser | 30 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_constants():
"""Test that ANSI constants have expected values."""
as... | "\x1b[0m" | assert | string_literal | tests/test_ansi.py | test_constants | 89 | null | |
hyprland-community/pyprland | from pyprland.models import VersionInfo
def test_version_info_init():
v = VersionInfo(1, 2, 3)
assert v.major == 1
assert v.minor == 2
assert v.micro == | 3 | assert | numeric_literal | tests/test_common_types.py | test_version_info_init | 8 | null | |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_cleanup_no_ttl(tmp_path):
"""cleanup() removes nothing when no TTL is set."""
cache = ImageCache(cache_dir=tmp_path)
old_file = tmp_path / "old.jpg"
old_file.write_bytes(b"data")
os.utime(o... | 0 | assert | numeric_literal | tests/test_wallpapers_cache.py | test_cache_cleanup_no_ttl | 131 | null | |
hyprland-community/pyprland | from pathlib import Path
import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.menubar import get_pid_from_layers_hyprland, is_bar_in_layers_niri, is_bar_alive, Extension
from tests.conftest import make_extension
@pytest.mark.asyncio
async def test_is_bar_alive_hyprland():
backend =... | "layers") | assert_* | string_literal | tests/test_plugin_menubar.py | test_is_bar_alive_hyprland | 69 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.interface import Plugin
from pyprland.config import Configuration
def plugin():
plugin = ConcretePlugin("test_plugin")
# Manually attach mocks for methods used in get_clients
plugin.hyprctl_json = AsyncMock()
plugin.st... | 2 | assert | numeric_literal | tests/test_interface.py | test_get_clients_filter | 103 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.layout import (
MAX_CYCLE_PATH_LENGTH,
MONITOR_PROPS,
build_graph,
compute_positions,
compute_xy,
find_cycle_path,
get_dims,
)
def make_monitor(name, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor d... | {} | assert | collection | tests/test_monitors_layout.py | test_circular_dependency | TestComputePositions | 311 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.resolution import (
get_monitor_by_pattern,
resolve_placement_config,
)
def make_monitor(name, description=None, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor dict."""
return {
"name": name,
"descr... | None | assert | none_literal | tests/test_monitors_resolution.py | test_match_by_name | TestGetMonitorByPattern | 40 | null |
hyprland-community/pyprland | import os
import time
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
def test_cache_hash_key(tmp_path):
"""_hash_key() generates consistent short hashes."""
cache = ImageCache(cache_dir=tmp_path)
# Same key should produce same hash
hash1 = cache._hash_key("test-key")
hash... | hash2 | assert | variable | tests/test_wallpapers_cache.py | test_cache_hash_key | 246 | null | |
hyprland-community/pyprland | import sys
import pytest
import tomllib
from pytest_asyncio import fixture
from .conftest import mocks as tst
sys.path.append("sample_extension")
async def external_plugin_config(monkeypatch):
"""External config."""
config = """
[pyprland]
plugins = ["pypr_examples.focus_counter"]
"""
monkeypatch.setatt... | 1 | assert | numeric_literal | tests/test_external_plugins.py | test_ext_plugin | 29 | null | |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | 2 | assert | numeric_literal | tests/test_wallpapers_imageutils.py | test_rounded_image_manager_paths | 111 | null | |
hyprland-community/pyprland | import asyncio
import pytest
from pytest_asyncio import fixture
from .conftest import mocks
from .testtools import wait_called
from unittest.mock import AsyncMock
def multi_scratchpads(monkeypatch, mocker):
d = {
"pyprland": {"plugins": ["scratchpads"]},
"scratchpads": {
"term": {
... | 2 | assert | numeric_literal | tests/test_scratchpad_vulnerabilities.py | test_zombie_process_recovery | 352 | null | |
hyprland-community/pyprland | import asyncio
import pytest
from pytest_asyncio import fixture
from .conftest import mocks
from .testtools import wait_called
def scratchpads(monkeypatch, mocker):
d = {
"pyprland": {"plugins": ["scratchpads"]},
"scratchpads": {
"term": {
"command": "ls",
... | None | assert | none_literal | tests/test_plugin_scratchpads.py | test_command_serialization | 404 | null | |
hyprland-community/pyprland | import os
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pyprland.plugins.wallpapers.cache import ImageCache
from pyprland.plugins.wallpapers.imageutils import (
IMAGE_FORMAT,
MonitorInfo,
RoundedImageManager,
expand_path,
get_effective_dimensions,
... | dest) | assert_* | variable | tests/test_wallpapers_imageutils.py | test_rounded_image_manager_processing | 183 | null | |
hyprland-community/pyprland | import os
from io import StringIO
from unittest.mock import patch
from pyprland.ansi import (
BOLD,
DIM,
RED,
RESET,
YELLOW,
HandlerStyles,
LogStyles,
colorize,
make_style,
should_colorize,
)
def test_should_colorize_respects_no_color():
"""Test that NO_COLOR environment va... | False | assert | bool_literal | tests/test_ansi.py | test_should_colorize_respects_no_color | 56 | null | |
hyprland-community/pyprland | import pytest
from unittest.mock import Mock, AsyncMock, patch
from pyprland.plugins.interface import Plugin
from pyprland.config import Configuration
def plugin():
plugin = ConcretePlugin("test_plugin")
# Manually attach mocks for methods used in get_clients
plugin.hyprctl_json = AsyncMock()
plugin.st... | 3 | assert | numeric_literal | tests/test_interface.py | test_get_clients_filter | 86 | null | |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.resolution import (
get_monitor_by_pattern,
resolve_placement_config,
)
def make_monitor(name, description=None, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor dict."""
return {
"name": name,
"descr... | {} | assert | collection | tests/test_monitors_resolution.py | test_empty_config | TestResolvePlacementConfig | 235 | null |
hyprland-community/pyprland | import logging
import pytest
from pyprland.adapters.wayland import WaylandBackend
from pyprland.adapters.xorg import XorgBackend
from pyprland.common import SharedState
def mock_state():
"""Provide a mock SharedState for tests."""
return SharedState()
class TestWaylandBackend:
def test_parse_single_monit... | 1 | assert | numeric_literal | tests/test_adapters_fallback.py | test_parse_single_monitor | TestWaylandBackend | 43 | null |
hyprland-community/pyprland | import pytest
from pyprland.plugins.monitors.layout import (
MAX_CYCLE_PATH_LENGTH,
MONITOR_PROPS,
build_graph,
compute_positions,
compute_xy,
find_cycle_path,
get_dims,
)
def make_monitor(name, width=1920, height=1080, x=0, y=0, scale=1.0, transform=0):
"""Helper to create a monitor d... | 0 | assert | numeric_literal | tests/test_monitors_layout.py | test_right | TestComputeXy | 131 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.