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 |
|---|---|---|---|---|---|---|---|---|---|
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
Route,
Solution,
VehicleType,
)
def test_tw_penalty():
"""
This test asserts that time window penalty computations are corr... | 2) | assert_* | numeric_literal | tests/test_CostEvaluator.py | test_tw_penalty | 91 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import mark
from pyvrp import RandomNumberGenerator
@mark.parametrize("seed", [2, 10, 42])
def test_rand(seed: int):
"""
Tests that repeatedly calling ``rand()`` should result in a sample that is
approximately ... | 1 / 12) | assert_* | complex_expr | tests/test_RandomNumberGenerator.py | test_rand | 56 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import Route, Trip
@pytest.mark.parametrize("visits", [[], [1], [2, 3]])
def test_trip_length_and_visits(ok_small, visits: list[int]):
"""
Tests that the trip length returns the number of client visits, and
visits() th... | visits) | assert_* | variable | tests/test_Trip.py | test_trip_length_and_visits | 58 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
CostEvaluator,
RandomNumberGenerator,
Result,
Solution,
Statistics,
)
from pyvrp.ProgressPrinter import ProgressPrinter
def test_should_print_false_no_output(ok_small, caplog):
"""
Tests that disabling print... | "") | assert_* | string_literal | tests/test_ProgressPrinter.py | test_should_print_false_no_output | 128 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
Client,
ClientGroup,
Depot,
Model,
PenaltyParams,
Profile,
SolveParams,
VehicleType,
)
from pyvrp.constants import MAX_VALUE
from pyvrp.exceptions import ScalingWarning
fr... | 6) | assert_* | numeric_literal | tests/test_Model.py | test_add_client_attributes | 109 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp import (
IteratedLocalSearch,
IteratedLocalSearchCallbacks,
IteratedLocalSearchParams,
PenaltyManager,
RandomNumberGenerator,
Result,
Solution,
)
from pyvrp.search import (
Ex... | 10) | assert_* | numeric_literal | tests/test_IteratedLocalSearch.py | test_ils_result_has_correct_stats | 125 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
RandomNumberGenerator,
Solution,
VehicleType,
)
from pyvrp import Route as SolRoute
from pyvrp.search import (
Exchange10,
Exchange11,
... | 1) | assert_* | numeric_literal | tests/search/test_Exchange.py | test_swap_single_route_stays_single_route | 62 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp import VehicleType
from pyvrp.search import NeighbourhoodParams, compute_neighbours
@mark.parametrize(
(
"weight_wait_time",
"weight_time_warp",
"num_neighbours",
"s... | rc208.num_locations) | assert_* | complex_expr | tests/search/test_neighbourhood.py | test_compute_neighbours | 99 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp import (
IteratedLocalSearch,
IteratedLocalSearchCallbacks,
IteratedLocalSearchParams,
PenaltyManager,
RandomNumberGenerator,
Result,
Solution,
)
from pyvrp.search import (
Ex... | init) | assert_* | variable | tests/test_IteratedLocalSearch.py | test_ils_result_has_correct_stats | 124 | null | |
PyVRP/PyVRP | from itertools import pairwise
import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import DurationSegment
_INT_MAX = np.iinfo(np.int64).max
def test_merge_two():
"""
Tests merging two duration segments.
"""
ds1 = DurationSegment(5, 0, 0, 5, 0)
ds2 =... | 8) | assert_* | numeric_literal | tests/test_DurationSegment.py | test_merge_two | 37 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import LoadSegment
_INT_MAX = np.iinfo(np.int64).max
@pytest.mark.parametrize(
("first", "second", "exp_delivery", "exp_pickup", "exp_load"),
[
(
LoadSegment(delivery=5, pickup=8, load=8),
... | exp_pickup) | assert_* | variable | tests/test_LoadSegment.py | test_merge_two | 55 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import Route, Trip
def test_load(ok_small):
"""
Tests load calculations for a small instance.
"""
trip = Trip(ok_small, [1, 2, 3, 4], 0)
assert_equal(trip.delivery(), [18])
assert_equal(trip.pickup(), | [0]) | assert_* | collection | tests/test_Trip.py | test_load | 148 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pyvrp
from pyvrp import CostEvaluator, RandomNumberGenerator
from pyvrp.search import (
PerturbationManager,
PerturbationParams,
compute_neighbours,
)
from pyvrp.search._search import SearchSpace, Solution
def test_pert... | [3]) | assert_* | collection | tests/search/test_PerturbationManager.py | test_perturb_switches_remove_insert | 141 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import mark
from pyvrp import RandomNumberGenerator
@mark.parametrize("seed", [2, 10, 42])
def test_rand(seed: int):
"""
Tests that repeatedly calling ``rand()`` should result in a sample that is
approximately ... | 1 / 2) | assert_* | complex_expr | tests/test_RandomNumberGenerator.py | test_rand | 55 | null | |
PyVRP/PyVRP | import numpy as np
from matplotlib.testing.decorators import image_comparison as img_comp
from numpy.testing import assert_equal, assert_raises
from pyvrp import (
CostEvaluator,
Depot,
ProblemData,
Result,
Route,
Solution,
Statistics,
Trip,
VehicleType,
plotting,
)
from tests.h... | ValueError) | assert_* | variable | tests/plotting/test_plotting.py | test_plot_demands_raises_for_out_of_bounds_load_dimension | 149 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import minimise_fleet
from pyvrp.stop import MaxIterations
from tests.helpers import read
def test_raises_multiple_vehicle_types(ok_small_multi_depot):
"""
Tests that ``minimise_fleet`` raises when given an instance with multiple
ve... | 2) | assert_* | numeric_literal | tests/test_minimise_fleet.py | test_raises_multiple_vehicle_types | 13 | null | |
PyVRP/PyVRP | import pickle
import numpy as np
import pytest
from numpy.random import default_rng
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import Client, ClientGroup, Depot, ProblemData, VehicleType
_INT_MAX = np.iinfo(np.int64).max
_MAX_SIZE = np.iinfo(np.uint64).max
def test_vehicle_type_does_n... | 0) | assert_* | numeric_literal | tests/test_ProblemData.py | test_vehicle_type_does_not_raise_for_all_zero_edge_case | 583 | null | |
PyVRP/PyVRP | import pickle
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp._pyvrp import DynamicBitset
def test_get_set_item():
"""
Tests that setting and retrieving an item from the bitset works correctly.
"""
bitset = DynamicBitset(128)
indices = [0, 1, 63, ... | len(indices)) | assert_* | func_call | tests/test_DynamicBitset.py | test_get_set_item | 75 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType
from pyvrp.search import RelocateWithDepot
from tests.helpers import make_search_route
def test_inserts_depot_single_route(ok_small_multiple_trips):
"""
Tes... | 1) | assert_* | numeric_literal | tests/search/test_RelocateWithDepot.py | test_inserts_depot_single_route | 19 | null | |
qtile/qtile | import shutil
import subprocess
import textwrap
import pytest
import libqtile.config
from libqtile.bar import Bar
from libqtile.widget import notify
def log_timeout(self, delay, func, method_args=None):
self.delay = delay
self.qtile.call_later(delay, func)
def notification(subject, body, urgency=None, timeo... | "" | assert | string_literal | test/widgets/test_notify.py | test_notifications | 141 | null | |
qtile/qtile | import textwrap
import pytest
import libqtile.config
import libqtile.widget.bluetooth
from libqtile.bar import Bar
from libqtile.config import Screen
from test.helpers import Retry
@Retry(ignore_exceptions=(AssertionError,))
def clipboard_cleared(widget):
assert widget.info()["text"] == | "" | assert | string_literal | test/widgets/test_clipboard.py | clipboard_cleared | 14 | null | |
qtile/qtile | from libqtile.widget import canto
OUTPUT = "maintag:Canto : 10\nmaintag:Slashdot : 9\nmaintag:MintyFresh : 6\n"
FIRST_TAG = "maintag:Canto"
SECOND_TAG = "maintag:Slashdot"
WRONG_TAG = "user:wrong"
def test_wrong_tags():
widget = canto.Canto(tags=[WRONG_TAG])
display_text = widget.parse(OUTPUT)
assert di... | "" | assert | string_literal | test/widgets/test_canto.py | test_wrong_tags | 29 | null | |
qtile/qtile | import pytest
from libqtile import layout
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import plasma
def plasma_manager(manager_nospawn, request):
class PlasmaConfig(Config):
layouts = [layout.Plasma()]
screens = [Screen(top=Bar([plasma.Plasma... | "H" | assert | string_literal | test/widgets/test_plasma.py | test_window_focus_change | 73 | null | |
qtile/qtile | import pytest
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import do_not_disturb as dnd
def mock_check_output(args):
status = str(DunstStatus.PAUSED).lower()
return status.encode()
def patched_dnd(monkeypatch):
monkeypatch.setattr("libqtile.widget.do... | "+" | assert | string_literal | test/widgets/test_do_not_disturb.py | test_dnd_custom_icons | 98 | null | |
qtile/qtile | import time
from collections import defaultdict
import pytest
from pytest import approx
from libqtile.config import Screen
from libqtile.confreader import Config
from libqtile.layout.plasma import AddMode, Node, NotRestorableError, Orient, Plasma, Priority
from test.layouts.layout_utils import assert_focused
Node.mi... | a | assert | variable | test/layouts/test_plasma.py | test_leaves | 258 | null | |
qtile/qtile | import pickle
import shutil
import textwrap
from multiprocessing import Value
import pytest
import libqtile.bar
import libqtile.config
import libqtile.layout
from libqtile import config, hook, layout
from libqtile.confreader import Config
from libqtile.ipc import IPCError
from libqtile.lazy import lazy
from libqtile.... | 2 | assert | numeric_literal | test/test_restart.py | test_restart_hook_and_state | 135 | null | |
qtile/qtile | import os
import subprocess
import sys
def run_qtile(args):
cmd = os.path.join(os.path.dirname(__file__), "..", "libqtile", "scripts", "main.py")
argv = [sys.executable, cmd]
argv.extend(args)
proc = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.commun... | "" | assert | string_literal | test/test_qtile_help.py | test_cmd_help_subcommand | 22 | null | |
qtile/qtile | from pathlib import Path
import pytest
from libqtile import config, confreader, utils
from libqtile.backend.base.core import Output
from libqtile.bar import Bar
from libqtile.config import Screen, ScreenRect
from libqtile.widget import TextBox
configs_dir = Path(__file__).resolve().parent / "configs"
def load_confi... | "b" | assert | string_literal | test/test_config.py | test_screen_serial_ordering_the_order | 116 | null | |
qtile/qtile | import pytest
from libqtile.core.lifecycle import Behavior, LifeCycle
from libqtile.log_utils import init_log
def fake_os_execv(executable, args):
assert args == [
"arg1",
"arg2",
"--no-spawn",
"--with-state=/tmp/test/fake_statefile",
]
def no_op(*args, **kwargs):
pass
de... | [] | assert | collection | test/core/test_lifecycle.py | test_none_behavior | 45 | null | |
qtile/qtile | from pathlib import Path
import pytest
from libqtile import config, confreader, utils
from libqtile.backend.base.core import Output
from libqtile.bar import Bar
from libqtile.config import Screen, ScreenRect
from libqtile.widget import TextBox
configs_dir = Path(__file__).resolve().parent / "configs"
def load_confi... | "a" | assert | string_literal | test/test_config.py | test_ezkey | 60 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
def _stacks(manager):
stacks = []
for i in manager.c.layout.info()["stacks"]:
windows = i["clients"]
current = i["curr... | "one" | assert | string_literal | test/layouts/test_stack.py | test_stack_nextprev | 117 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import bar, layout
from libqtile.config import Screen
from libqtile.confreader import Config
from libqtile.widget.tasklist import TaskList
from test.layouts.layout_utils import assert_focused
from test.test_scratchpad import is_spawned, spawn_cmd
def override_xdg(req... | "Two" | assert | string_literal | test/widgets/test_tasklist.py | test_tasklist_click_task | 227 | null | |
qtile/qtile | import time
import pytest
import libqtile
from test.helpers import Retry
@Retry(ignore_exceptions=(AssertionError,), tmax=10)
def wait_for_window():
assert len(manager.c.windows()) > | 0 | assert | numeric_literal | test/test_dgroups.py | wait_for_window | 81 | null | |
qtile/qtile | import sys
from importlib import reload
from types import ModuleType
import pytest
from test.widgets.conftest import FakeBar
def patch_net(fake_qtile, monkeypatch, fake_window):
def build_widget(**kwargs):
monkeypatch.setitem(sys.modules, "psutil", MockPsutil("psutil"))
from libqtile.widget impor... | "" | assert | string_literal | test/widgets/test_net.py | test_net_missing_interface | 107 | null | |
qtile/qtile | import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
from libqtile.widget import CurrentScreen
from test.conftest import dualmonitor
ACTIVE = "#FF0000"
INACTIVE = "#00FF00"
@dualmonitor
def test_change_screen(manager_nospawn, minimal_conf_noscreen):
cswidget = CurrentScreen... | "I" | assert | string_literal | test/widgets/test_currentscreen.py | test_change_screen | 30 | null | |
qtile/qtile | import pytest
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import redshift
def mock_run(argv, check):
pass
def patched_redshift(monkeypatch):
class PatchedRedshift(redshift.Redshift):
def __init__(self, **config):
monkeypatch.setattr(... | val | assert | variable | test/widgets/test_redshift.py | test_defaults | 76 | null | |
qtile/qtile | import pytest
import libqtile.config
import libqtile.resources.default_config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
def assert_z_stack(manager, windows):
if manager.backend.name != "x11":
# TODO: Test wayl... | ["one"]) | assert_* | collection | test/layouts/test_max.py | test_max_simple | 64 | null | |
qtile/qtile | import cairocffi
import pytest
from libqtile import bar, images
from libqtile.widget import Volume
from test.widgets.conftest import TEST_DIR, FakeBar
def test_images_good(tmpdir, fake_bar, svg_img_as_pypath):
names = (
"audio-volume-high.svg",
"audio-volume-low.svg",
"audio-volume-medium.... | len(names) | assert | func_call | test/widgets/test_volume.py | test_images_good | 31 | null | |
qtile/qtile | import pytest
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import do_not_disturb as dnd
def mock_check_output(args):
status = str(DunstStatus.PAUSED).lower()
return status.encode()
def patched_dnd(monkeypatch):
monkeypatch.setattr("libqtile.widget.do... | "X" | assert | string_literal | test/widgets/test_do_not_disturb.py | test_dnd | 66 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@tile_config
def test_tile_master_and_slave(manager):
manager.test_window("one")
manager.test_window("two")
manager.test_window("t... | ["one"] | assert | collection | test/layouts/test_tile.py | test_tile_master_and_slave | 79 | null | |
qtile/qtile | import faulthandler
import functools
import logging
import multiprocessing
import os
import signal
import subprocess
import sys
import tempfile
import time
import traceback
from abc import ABCMeta, abstractmethod
from pathlib import Path
from libqtile import command, config, ipc, layout
from libqtile.confreader import... | g["name"] | assert | complex_expr | test/helpers.py | groupconsistency | TestManager | 407 | null |
qtile/qtile | from libqtile.config import Screen
def test_screen_equality_bad_serial():
# Two screens with different geometry but SAME bad serial
s1 = Screen(x=0, y=0, width=1920, height=1080, serial="000000000000")
s2 = Screen(x=1920, y=0, width=1920, height=1080, serial="000000000000")
# Should NOT be equal becau... | s2 | assert | variable | test/config/test_screen_serial.py | test_screen_equality_bad_serial | 10 | null | |
qtile/qtile | from libqtile.command.base import CommandError
def assert_focused(self, name):
"""Asserts that window with specified name is currently focused"""
info = self.c.window.info()
assert info["name"] == name, "Got {!r}, expected {!r}".format(info["name"], name)
def assert_unfocused(self, name):
"""Asserts t... | y | assert | variable | test/layouts/layout_utils.py | assert_dimensions | 26 | null | |
qtile/qtile | import pytest
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import do_not_disturb as dnd
def mock_check_output(args):
status = str(DunstStatus.PAUSED).lower()
return status.encode()
def patched_dnd(monkeypatch):
monkeypatch.setattr("libqtile.widget.do... | "O" | assert | string_literal | test/widgets/test_do_not_disturb.py | test_dnd | 62 | null | |
qtile/qtile | import faulthandler
import functools
import logging
import multiprocessing
import os
import signal
import subprocess
import sys
import tempfile
import time
import traceback
from abc import ABCMeta, abstractmethod
from pathlib import Path
from libqtile import command, config, ipc, layout
from libqtile.confreader import... | len(screens) | assert | func_call | test/helpers.py | groupconsistency | TestManager | 408 | null |
qtile/qtile | import cairocffi
import pytest
from libqtile import bar, images
from libqtile.widget import Volume
from test.widgets.conftest import TEST_DIR, FakeBar
def test_text():
fmt = "Volume: {}"
vol = Volume(fmt=fmt)
vol.volume = -1
vol._update_drawer()
assert vol.text == "M"
vol.volume = 50
vol.... | "50%" | assert | string_literal | test/widgets/test_volume.py | test_text | 68 | null | |
qtile/qtile | import asyncio
import os
from collections import OrderedDict
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch
import pytest
from libqtile import utils
def path(monkeypatch):
"Create a TemporaryDirectory as the PATH"
with TemporaryDirectory() as d:
... | "test" | assert | string_literal | test/test_utils.py | test_acall_process_adds_removes_pid | 196 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@matrix_config
def test_matrix_navigation(manager):
manager.test_window("one")
manager.test_window("two")
manager.test_window("thr... | (0, 0) | assert | collection | test/layouts/test_matrix.py | test_matrix_navigation | 49 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
def _stacks(manager):
stacks = []
for i in manager.c.layout.info()["stacks"]:
windows = i["clients"]
current = i["curr... | ["one"] | assert | collection | test/layouts/test_stack.py | test_stack_client_to | 190 | null | |
qtile/qtile | from libqtile.command.base import CommandError
def assert_focused(self, name):
"""Asserts that window with specified name is currently focused"""
info = self.c.window.info()
assert info["name"] == name, "Got {!r}, expected {!r}".format(info["name"], name)
def assert_unfocused(self, name):
"""Asserts t... | x | assert | variable | test/layouts/layout_utils.py | assert_dimensions | 25 | null | |
qtile/qtile | import pytest
import libqtile.bar
import libqtile.config
import libqtile.layout
from libqtile.confreader import Config
from libqtile.extension.window_list import WindowList
from libqtile.lazy import lazy
def extension_manager(monkeypatch, manager_nospawn):
extension = WindowList()
# We want the value returne... | "a" | assert | string_literal | test/extension/test_window_list.py | test_window_list | 60 | null | |
qtile/qtile | import pytest
from libqtile import images
from libqtile.widget import battery
from libqtile.widget.battery import Battery, BatteryIcon, BatteryState, BatteryStatus
from test.widgets.conftest import TEST_DIR, FakeBar
def dummy_load_battery(bat):
def load_battery(**config):
return DummyBattery(bat)
ret... | "" | assert | string_literal | test/widgets/test_battery.py | test_text_battery_hidden | 201 | null | |
qtile/qtile | import libqtile.config
from libqtile.widget.check_updates import CheckUpdates, Popen # noqa: F401
from test.widgets.conftest import FakeBar
wrong_distro = "Barch"
good_distro = "Arch"
cmd_0_line = "export toto" # quick "monkeypatch" simulating 0 output, ie 0 update
cmd_1_line = "echo toto" # quick "monkeypatch" sim... | "N/A" | assert | string_literal | test/widgets/test_check_updates.py | test_unknown_distro | 42 | null | |
qtile/qtile | import os
from glob import glob
from os import path
import cairocffi
import cairocffi.pixbuf
import pytest
from libqtile import images
TEST_DIR = path.dirname(os.path.abspath(__file__))
DATA_DIR = path.join(TEST_DIR, "data")
PNGS = glob(path.join(DATA_DIR, "*", "*.png"))
SVGS = glob(path.join(DATA_DIR, "*", "*.svg")... | pat1 | assert | variable | test/test_images.py | test_setting | TestImg | 98 | null |
qtile/qtile | import pytest
import libqtile
from libqtile.confreader import Config
from libqtile.widget import WindowCount
@different_screens
def test_different_screens(manager):
# Put one window on screen 0
manager.c.to_screen(0)
manager.test_window("one")
# Put two windows on screen 1
manager.c.to_screen(1)
... | "1" | assert | string_literal | test/widgets/test_window_count.py | test_different_screens | 60 | null | |
qtile/qtile | import pytest
from libqtile.backend.base.idle_inhibit import IdleInhibitorManager
from libqtile.config import IdleInhibitor, Match
from libqtile.confreader import Config
from test.helpers import Retry
def is_inhibited(manager):
return len(manager.c.core.get_idle_inhibitors(active_only=True)) > 0
def wait_for_win... | 2 | assert | numeric_literal | test/backend/test_idle_inhibit.py | test_inhibitor_manager | 55 | null | |
qtile/qtile | import asyncio
import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
import libqtile.log_utils
import libqtile.widget
from libqtile.command.base import CommandError, CommandException, CommandObject, expose_command
from libqtile.command.client import CommandClient
f... | "a" | assert | string_literal | test/test_command.py | test_select_qtile | 233 | null | |
qtile/qtile | import asyncio
import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
import libqtile.log_utils
import libqtile.widget
from libqtile.command.base import CommandError, CommandException, CommandObject, expose_command
from libqtile.command.client import CommandClient
f... | 0 | assert | numeric_literal | test/test_command.py | test_select_qtile | 254 | null | |
qtile/qtile | import os
from glob import glob
from os import path
import cairocffi
import cairocffi.pixbuf
import pytest
from libqtile import images
TEST_DIR = path.dirname(os.path.abspath(__file__))
DATA_DIR = path.join(TEST_DIR, "data")
PNGS = glob(path.join(DATA_DIR, "*", "*.png"))
SVGS = glob(path.join(DATA_DIR, "*", "*.svg")... | 1 | assert | numeric_literal | test/test_images.py | test_setting_negative_size | TestImg | 116 | null |
qtile/qtile | import pytest
from libqtile import layout
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import plasma
def plasma_manager(manager_nospawn, request):
class PlasmaConfig(Config):
layouts = [layout.Plasma()]
screens = [Screen(top=Bar([plasma.Plasma... | "V" | assert | string_literal | test/widgets/test_plasma.py | test_window_focus_change | 82 | null | |
qtile/qtile | import pytest
from libqtile import config, ipc, resources
from libqtile.bar import Bar
from libqtile.command.base import expose_command
from libqtile.command.interface import IPCCommandInterface
from libqtile.confreader import Config
from libqtile.layout import Max
from libqtile.sh import COMMA_MATCHER, QSh, split_arg... | 3 | assert | numeric_literal | test/test_sh.py | test_comma_splitting | 171 | null | |
qtile/qtile | import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
import libqtile.widget as widgets
from libqtile.widget.base import ORIENTATION_BOTH, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL
from libqtile.widget.clock import Clock
from libqtile.widget.crashme import _Crash... | widget.name | assert | complex_expr | test/widgets/test_widget_init_configure.py | test_widget_init_config | 100 | null | |
qtile/qtile | import asyncio
import contextlib
import pytest
from libqtile.interactive.repl import (
REPL_PORT,
TERMINATOR,
QtileREPLServer,
get_completions,
)
def test_get_completions_invalid_expr():
result = get_completions("invalid..expr", {})
assert result == | [] | assert | collection | test/shell_scripts/test_repl_server.py | test_get_completions_invalid_expr | 38 | null | |
qtile/qtile | import pytest
import xcffib
import xcffib.testing
from libqtile.backend.x11 import window, xcbq
def test_edid_decoding():
edid = b"\x00\xff\xff\xff\xff\xff\xff\x00L\x83\x9fA\x00\x00\x00\x00\x00!\x01\x04\xb5\x1e\x13x\x02\x0c\xf1\xaeR<\xb9#\x0cPT\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x... | "SDC" | assert | string_literal | test/backend/x11/test_xcbq.py | test_edid_decoding | 40 | null | |
qtile/qtile | import libqtile.config
from libqtile.widget.check_updates import CheckUpdates, Popen # noqa: F401
from test.widgets.conftest import FakeBar
wrong_distro = "Barch"
good_distro = "Arch"
cmd_0_line = "export toto" # quick "monkeypatch" simulating 0 output, ie 0 update
cmd_1_line = "echo toto" # quick "monkeypatch" sim... | nus | assert | variable | test/widgets/test_check_updates.py | test_no_update_available_with_no_update_string_and_color_no_updates | 77 | null | |
qtile/qtile | import os
from glob import glob
from os import path
import cairocffi
import cairocffi.pixbuf
import pytest
from libqtile import images
TEST_DIR = path.dirname(os.path.abspath(__file__))
DATA_DIR = path.join(TEST_DIR, "data")
PNGS = glob(path.join(DATA_DIR, "*", "*.png"))
SVGS = glob(path.join(DATA_DIR, "*", "*.svg")... | img2 | assert | variable | test/test_images.py | test_from_path | TestImg | 81 | null |
qtile/qtile | import pytest
from libqtile import config, ipc, resources
from libqtile.bar import Bar
from libqtile.command.base import expose_command
from libqtile.command.interface import IPCCommandInterface
from libqtile.confreader import Config
from libqtile.layout import Max
from libqtile.sh import COMMA_MATCHER, QSh, split_arg... | "OK" | assert | string_literal | test/test_sh.py | test_call | 85 | null | |
qtile/qtile | import shutil
import subprocess
import textwrap
import pytest
import libqtile.config
from libqtile.bar import Bar
from libqtile.widget import notify
def log_timeout(self, delay, func, method_args=None):
self.delay = delay
self.qtile.call_later(delay, func)
def notification(subject, body, urgency=None, timeo... | {"body"} | assert | collection | test/widgets/test_notify.py | test_capabilities | 168 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.helpers import HEIGHT, WIDTH
from test.layouts.layout_utils import assert_dimensions, assert_focus_path, assert_focused
@columns_config
def test_columns_swap_column_left(manager):
manager.test_window(... | ["2"] | assert | collection | test/layouts/test_columns.py | test_columns_swap_column_left | 95 | null | |
qtile/qtile | import json
import os
import re
import subprocess
import sys
import pytest
import libqtile.bar
import libqtile.config
import libqtile.layout
import libqtile.widget
from libqtile.command.base import expose_command
from libqtile.confreader import Config
from libqtile.lazy import lazy
def run_qtile_cmd(args, no_json_lo... | 0 | assert | numeric_literal | test/test_qtile_cmd.py | test_qtile_cmd | 111 | null | |
qtile/qtile | import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
from libqtile.widget import CurrentScreen
from test.conftest import dualmonitor
ACTIVE = "#FF0000"
INACTIVE = "#00FF00"
@dualmonitor
def test_change_screen(manager_nospawn, minimal_conf_noscreen):
cswidget = CurrentScreen... | "A" | assert | string_literal | test/widgets/test_currentscreen.py | test_change_screen | 25 | null | |
qtile/qtile | import os
import shutil
import subprocess
import tempfile
from multiprocessing import Value
import pytest
import xcffib.xproto
import xcffib.xtest
import libqtile.config
from libqtile import hook, layout, utils
from libqtile.backend.x11 import window, xcbq
from libqtile.backend.x11.xcbq import Connection
from test.co... | 1 | assert | numeric_literal | test/backend/x11/test_window.py | test_urgent_hook_fire | 113 | null | |
qtile/qtile | import sys
from pathlib import Path
import pytest
import libqtile.config
import libqtile.layout
import libqtile.widget
from libqtile.confreader import Config
from test.helpers import Retry
from test.layouts.layout_utils import assert_focus_path, assert_focused
def spawn_cmd(title):
script = Path(__file__).parent... | ["one"] | assert | collection | test/test_scratchpad.py | test_sratchpad_with_matcher | 78 | null | |
qtile/qtile | import time
import pytest
import libqtile
from test.helpers import Retry
@dgroups_config
def test_dgroup_persist(manager):
# create dgroup
gname = "c"
manager.c.addgroup(gname, persist=True)
# switch to dgroup
manager.c.group[gname].toscreen()
# start window
one = manager.test_window("t... | 3 | assert | numeric_literal | test/test_dgroups.py | test_dgroup_persist | 49 | null | |
qtile/qtile | import pytest
from libqtile import layout
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import plasma
def plasma_manager(manager_nospawn, request):
class PlasmaConfig(Config):
layouts = [layout.Plasma()]
screens = [Screen(top=Bar([plasma.Plasma... | " H" | assert | string_literal | test/widgets/test_plasma.py | test_plasma_defaults | 30 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@tile_config
def test_tile_remove(manager):
one = manager.test_window("one")
manager.test_window("two")
three = manager.test_windo... | ["two"] | assert | collection | test/layouts/test_tile.py | test_tile_remove | 92 | null | |
qtile/qtile | import pytest
from libqtile import layout
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import plasma
def plasma_manager(manager_nospawn, request):
class PlasmaConfig(Config):
layouts = [layout.Plasma()]
screens = [Screen(top=Bar([plasma.Plasma... | "=" | assert | string_literal | test/widgets/test_plasma.py | test_custom_text | 55 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@tile_config
def test_tile_nextprev(manager):
manager.test_window("one")
manager.test_window("two")
manager.test_window("three")
... | "one" | assert | string_literal | test/layouts/test_tile.py | test_tile_nextprev | 60 | null | |
qtile/qtile | import datetime
import sys
from importlib import reload
import pytest
import libqtile.config
from libqtile.widget import clock
from test.widgets.conftest import FakeBar
def no_op(*args, **kwargs):
pass
def patched_clock(monkeypatch):
# Stop system importing these modules in case they exist on environment
... | caplog.text | assert | complex_expr | test/widgets/test_clock.py | test_clock_invalid_timezone | 85 | null | |
qtile/qtile | import asyncio
import os
from collections import OrderedDict
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch
import pytest
from libqtile import utils
def path(monkeypatch):
"Create a TemporaryDirectory as the PATH"
with TemporaryDirectory() as d:
... | 0 | assert | numeric_literal | test/test_utils.py | test_acall_process_adds_removes_pid | 197 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import bar, layout, widget
from libqtile.config import Screen
from libqtile.confreader import Config
@windowname_config
def test_window_names(manager):
def widget_text_on_screen(index):
return manager.c.screen[index].bar["top"].info()["widgets"][0]["text"... | " " | assert | string_literal | test/widgets/test_windowname.py | test_window_names | 56 | null | |
qtile/qtile | from importlib import reload
import pytest
from test.widgets.conftest import FakeBar
async def mock_signal_receiver(*args, **kwargs):
return True
def patched_widget(monkeypatch):
from libqtile.widget import keyboardkbdd
reload(keyboardkbdd)
# The next line shouldn't be necessary but I got occasion... | "N/A" | assert | string_literal | test/widgets/test_keyboardkbdd.py | test_keyboardkbdd_process_not_running | 63 | null | |
qtile/qtile | import asyncio
import multiprocessing
import os
import shutil
import signal
import subprocess
import time
from enum import Enum
import pytest
from dbus_fast.aio import MessageBus
from dbus_fast.constants import BusType, PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method
from libqtile... | "BT " | assert | string_literal | test/widgets/test_bluetooth.py | test_missing_adapter | 423 | null | |
qtile/qtile | import pickle
import shutil
import textwrap
from multiprocessing import Value
import pytest
import libqtile.bar
import libqtile.config
import libqtile.layout
from libqtile import config, hook, layout
from libqtile.confreader import Config
from libqtile.ipc import IPCError
from libqtile.lazy import lazy
from libqtile.... | 0 | assert | numeric_literal | test/test_restart.py | test_restart_hook_and_state | 84 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
def _stacks(manager):
stacks = []
for i in manager.c.layout.info()["stacks"]:
windows = i["clients"]
current = i["curr... | "two" | assert | string_literal | test/layouts/test_stack.py | test_stack_nextprev | 122 | null | |
qtile/qtile | import logging
from pathlib import Path
import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.hook
import libqtile.layout
import libqtile.widget
from libqtile.command.client import SelectError
from libqtile.command.interface import CommandError, CommandException
from libq... | 2 | assert | numeric_literal | test/test_manager.py | test_kill_other | 445 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@matrix_config
def test_matrix_navigation(manager):
manager.test_window("one")
manager.test_window("two")
manager.test_window("thr... | (0, 1) | assert | collection | test/layouts/test_matrix.py | test_matrix_navigation | 47 | null | |
qtile/qtile | import pytest
from libqtile.backend.base.idle_inhibit import IdleInhibitorManager
from libqtile.config import IdleInhibitor, Match
from libqtile.confreader import Config
from test.helpers import Retry
def is_inhibited(manager):
return len(manager.c.core.get_idle_inhibitors(active_only=True)) > 0
def wait_for_win... | 3 | assert | numeric_literal | test/backend/test_idle_inhibit.py | test_inhibitor_manager | 59 | null | |
qtile/qtile | import asyncio
from multiprocessing import Value
import pytest
import libqtile.log_utils
import libqtile.utils
from libqtile import hook, layout
from libqtile.resources import default_config
from test.conftest import BareConfig, dualmonitor
from test.helpers import Retry
def hook_fixture():
libqtile.log_utils.in... | 1 | assert | numeric_literal | test/test_hook.py | test_can_subscribe_to_startup_hooks | 139 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
@matrix_config
def test_matrix_simple(manager):
manager.test_window("one")
assert manager.c.layout.info()["rows"] == | [["one"]] | assert | collection | test/layouts/test_matrix.py | test_matrix_simple | 30 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.confreader import Config
from test.helpers import Retry
from test.layouts.layout_utils import assert_dimensions, assert_focus_path, assert_focused
@Retry(ignore_exceptions=(AssertionError))
def assert_window_count(num):
as... | num | assert | variable | test/layouts/test_xmonad.py | assert_window_count | 652 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import bar, layout
from libqtile.config import Screen
from libqtile.confreader import Config
from libqtile.widget.tasklist import TaskList
from test.layouts.layout_utils import assert_focused
from test.test_scratchpad import is_spawned, spawn_cmd
def override_xdg(req... | "One" | assert | string_literal | test/widgets/test_tasklist.py | test_tasklist_click_task | 234 | null | |
qtile/qtile | import os
import sys
import tempfile
from pathlib import Path
import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.layout
import libqtile.widget
from libqtile.command.base import CommandError
from test.conftest import dualmonitor
from test.helpers import BareConfig, Retr... | 0 | assert | numeric_literal | test/test_bar.py | test_prompt | 126 | null | |
qtile/qtile | import sys
from pathlib import Path
import pytest
import libqtile.config
import libqtile.layout
import libqtile.widget
from libqtile.confreader import Config
from test.helpers import Retry
from test.layouts.layout_utils import assert_focus_path, assert_focused
def spawn_cmd(title):
script = Path(__file__).parent... | "one") | assert_* | string_literal | test/test_scratchpad.py | test_sratchpad_with_matcher | 91 | null | |
qtile/qtile | import pytest
import libqtile.config
import libqtile.resources.default_config
from libqtile import layout
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_focus_path, assert_focused
def assert_z_stack(manager, windows):
if manager.backend.name != "x11":
# TODO: Test wayl... | "one" | assert | string_literal | test/layouts/test_max.py | test_max_updown | 93 | null | |
qtile/qtile | import sys
from pathlib import Path
import pytest
import libqtile.config
import libqtile.layout
import libqtile.widget
from libqtile.confreader import Config
from test.helpers import Retry
from test.layouts.layout_utils import assert_focus_path, assert_focused
def spawn_cmd(title):
script = Path(__file__).parent... | "two") | assert_* | string_literal | test/test_scratchpad.py | test_focus_cycle | 176 | null | |
qtile/qtile | import pytest
import libqtile.config
from libqtile import layout
from libqtile.config import Match
from libqtile.confreader import Config
from test.layouts.layout_utils import assert_dimensions
def ss_manager(manager_nospawn, request):
class ScreenSplitConfig(Config):
auto_fullscreen = True
groups... | [] | assert | collection | test/layouts/test_screensplit.py | test_screensplit | 43 | null | |
qtile/qtile | import logging
from pathlib import Path
import pytest
import libqtile.bar
import libqtile.config
import libqtile.confreader
import libqtile.hook
import libqtile.layout
import libqtile.widget
from libqtile.command.client import SelectError
from libqtile.command.interface import CommandError, CommandException
from libq... | 0 | assert | numeric_literal | test/test_manager.py | test_screen_dim | 81 | null | |
qtile/qtile | import pytest
from libqtile import bar, config, hook, layout, log_utils, resources, widget
from libqtile.confreader import Config
from test.conftest import BareConfig, dualmonitor
from test.helpers import window_by_name
from test.layouts.layout_utils import assert_focused, assert_unfocused
from test.test_manager impor... | "b" | assert | string_literal | test/test_window.py | test_togroup_toggle | 118 | null | |
qtile/qtile | import pytest
from libqtile import layout
from libqtile.config import Bar, Screen
from libqtile.confreader import Config
from libqtile.widget import plasma
def plasma_manager(manager_nospawn, request):
class PlasmaConfig(Config):
layouts = [layout.Plasma()]
screens = [Screen(top=Bar([plasma.Plasma... | " V" | assert | string_literal | test/widgets/test_plasma.py | test_plasma_defaults | 33 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.