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
kivy/buildozer
import os.path import sys import tempfile from unittest import mock import pytest from buildozer.buildops import CommandResult from buildozer.exceptions import BuildozerCommandException from buildozer.targets.ios import TargetIos from tests.targets.utils import ( init_buildozer, patch_buildops_checkbin, p...
[ mock.call( "Cannot create the IPA package without signature. " 'You must fill the "ios.codesign.debug" token.' ) ]
assert
collection
tests/targets/test_ios.py
test_build_package_no_signature
TestTargetIos
208
null
kivy/buildozer
import sys import unittest from unittest import mock from buildozer.exceptions import BuildozerCommandException from buildozer.scripts import client class TestClient(unittest.TestCase): def test_exit_code(self): """ Makes sure the CLI exits with error code on BuildozerCommandException, refs #674....
1
assert
numeric_literal
tests/scripts/test_client.py
test_exit_code
TestClient
27
null
kivy/buildozer
from os import environ from pathlib import Path from tempfile import TemporaryDirectory import unittest from buildozer.specparser import SpecParser class TestSpecParser(unittest.TestCase): def test_new_getters(self): sp = SpecParser() sp.read_string( """ [section1] ...
True
assert
bool_literal
tests/test_specparser.py
test_new_getters
TestSpecParser
108
null
kivy/buildozer
import re import os import codecs import shutil import unittest import buildozer as buildozer_module from buildozer import Buildozer from io import StringIO from sys import platform import tempfile from unittest import mock from unittest.mock import PropertyMock from buildozer.targets.android import ( TargetAndroi...
my_ant_path
assert
variable
tests/test_buildozer.py
test_android_ant_path
TestBuildozer
136
null
kivy/buildozer
import re import os import codecs import shutil import unittest import buildozer as buildozer_module from buildozer import Buildozer from io import StringIO from sys import platform import tempfile from unittest import mock from unittest.mock import PropertyMock from buildozer.targets.android import ( TargetAndroi...
2
assert
numeric_literal
tests/test_buildozer.py
test_log_get_set
TestBuildozer
97
null
kivy/buildozer
import os import os.path import tempfile from io import StringIO from unittest import mock import sys import pytest from buildozer.targets.android import TargetAndroid from tests.targets.utils import ( init_buildozer, patch_buildops_checkbin, patch_buildops_cmd, patch_buildops_file_exists, ) def patc...
"sdl2"
assert
string_literal
tests/targets/test_android.py
test_init
TestTargetAndroid
112
null
kivy/buildozer
from os import environ from pathlib import Path from tempfile import TemporaryDirectory import unittest from buildozer.specparser import SpecParser class TestSpecParser(unittest.TestCase): def test_profiles(self): sp = SpecParser() sp.read_string( """ [section1] ...
"demo mode"
assert
string_literal
tests/test_specparser.py
test_profiles
TestSpecParser
147
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
ScreenShotError, match=message)
pytest.raises
complex_expr
src/tests/test_xcb.py
test_xgetimage_visual_validation_failures
334
null
BoboTiG/python-mss
from collections.abc import Callable from mss.base import MSSBase def test_keys_aio(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: all_monitors = sct.monitors[0] assert "top" in
all_monitors
assert
variable
src/tests/test_find_monitors.py
test_keys_aio
18
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
{0}
assert
collection
src/tests/test_gnu_linux.py
test_fast_function_for_monitor_details_retrieval
191
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
[1, 2]
assert
collection
src/tests/test_xcb.py
test_array_from_xcb_keeps_parent_alive_until_array_gone
143
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
1
assert
numeric_literal
src/tests/test_implementation.py
test_entry_point_error
209
null
BoboTiG/python-mss
import itertools from collections.abc import Callable import pytest from mss.base import MSSBase, ScreenShot from mss.exception import ScreenShotError def test_grab_part_of_screen(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: for width, height in itertools.product(range(1, 42), range...
160
assert
numeric_literal
src/tests/test_get_pixels.py
test_grab_part_of_screen
29
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
2020
assert
numeric_literal
src/tests/test_tools.py
test_parse_edid_manufacture_year_only
132
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
12345
assert
numeric_literal
src/tests/test_tools.py
test_parse_edid_serial_number_integer
153
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
{0, 255}
assert
collection
src/tests/test_gnu_linux.py
test_with_cursor
263
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
{}
assert
collection
src/tests/test_xcb.py
test_atom_cache_lifecycle
299
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
None
assert
none_literal
src/tests/test_implementation.py
test_monitor_option_and_quiet
TestEntryPoint
135
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
mss.linux.xshmgetimage.ShmStatus.UNAVAILABLE
assert
complex_expr
src/tests/test_gnu_linux.py
test_shm_fallback
318
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
captured.out
assert
complex_expr
src/tests/test_implementation.py
test_entry_point_with_no_argument
230
null
BoboTiG/python-mss
from collections.abc import Callable import pytest from mss.base import MSSBase np = pytest.importorskip("numpy", reason="Numpy module not available.") def test_numpy(mss_impl: Callable[..., MSSBase]) -> None: box = {"top": 0, "left": 0, "width": 10, "height": 10} with mss_impl() as sct: img = np.ar...
10
assert
numeric_literal
src/tests/third_party/test_numpy.py
test_numpy
18
null
BoboTiG/python-mss
import ctypes.util import platform from unittest.mock import patch import pytest import mss from mss.exception import ScreenShotError import mss.darwin def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None: # No `CoreGraphics` library version = float(".".join(platform.mac_ver()[0].split(".")[:2])...
modified["height"]
assert
complex_expr
src/tests/test_macos.py
test_implementation
63
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
xcb._ATOM_CACHE
assert
complex_expr
src/tests/test_xcb.py
test_atom_cache_lifecycle
298
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
im2.pos
assert
complex_expr
src/tests/test_implementation.py
test_grab_with_tuple
251
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
2021
assert
numeric_literal
src/tests/test_tools.py
test_parse_edid_model_year
146
null
BoboTiG/python-mss
import itertools from collections.abc import Callable import pytest from mss.base import MSSBase, ScreenShot from mss.exception import ScreenShotError def test_get_pixel(raw: bytes) -> None: image = ScreenShot.from_size(bytearray(raw), 1024, 768) assert image.width == 1024 assert image.height ==
768
assert
numeric_literal
src/tests/test_get_pixels.py
test_get_pixel
38
null
BoboTiG/python-mss
import itertools from collections.abc import Callable import pytest from mss.base import MSSBase, ScreenShot from mss.exception import ScreenShotError def test_grab_part_of_screen(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: for width, height in itertools.product(range(1, 42), range...
height
assert
variable
src/tests/test_get_pixels.py
test_grab_part_of_screen
32
null
BoboTiG/python-mss
from collections.abc import Callable from datetime import datetime from pathlib import Path import pytest from mss.base import MSSBase def test_output_format_simple(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: filename = sct.shot(mon=1, output="mon-{mon}.png") assert filename =...
"mon-1.png"
assert
string_literal
src/tests/test_save.py
test_output_format_simple
55
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
10
assert
numeric_literal
src/tests/test_tools.py
test_parse_edid_manufacture_week_and_year
140
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
xcb.XError, match="X server failed to intern atom")
pytest.raises
complex_expr
src/tests/test_xcb.py
test_raises_when_missing_and_not_only_if_exists
TestInternAtom
284
null
BoboTiG/python-mss
import ctypes.util import platform from unittest.mock import patch import pytest import mss from mss.exception import ScreenShotError import mss.darwin def test_repr() -> None: # CGPoint point = mss.darwin.CGPoint(2.0, 1.0) ref1 = mss.darwin.CGPoint() ref1.x = 2.0 ref1.y = 1.0 assert repr(po...
repr(ref2)
assert
func_call
src/tests/test_macos.py
test_repr
33
null
BoboTiG/python-mss
from collections.abc import Callable from mss.base import MSSBase def test_keys_monitor_1(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: mon1 = sct.monitors[1] assert "top" in
mon1
assert
variable
src/tests/test_find_monitors.py
test_keys_monitor_1
27
null
BoboTiG/python-mss
from __future__ import annotations import threading import pytest import mss def test_region_caching() -> None: """The region to grab is cached, ensure this is well-done.""" with mss.mss() as sct: assert isinstance(sct, mss.windows.MSS) # For Mypy # Grab the area 1 region1 = {"top"...
id(sct._dib)
assert
func_call
src/tests/test_windows.py
test_region_caching
38
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
before
assert
variable
src/tests/test_xcb.py
test_atom_cache_lifecycle
302
null
BoboTiG/python-mss
from collections.abc import Callable from datetime import datetime from pathlib import Path import pytest from mss.base import MSSBase def test_output_format_positions_and_sizes(mss_impl: Callable[..., MSSBase]) -> None: fmt = "sct-{top}x{left}_{width}x{height}.png" with mss_impl() as sct: filename =...
fmt.format(**sct.monitors[1])
assert
func_call
src/tests/test_save.py
test_output_format_positions_and_sizes
63
null
BoboTiG/python-mss
import platform from collections.abc import Callable import pytest from mss.base import MSSBase def test_primary_monitor(mss_impl: Callable[..., MSSBase]) -> None: """Test that primary_monitor property works correctly.""" with mss_impl() as sct: primary = sct.primary_monitor monitors = sct.mo...
True
assert
bool_literal
src/tests/test_primary_monitor.py
test_primary_monitor
31
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
2
assert
numeric_literal
src/tests/test_implementation.py
run_test
TestThreadSafety
316
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
"Test Monitor"
assert
string_literal
src/tests/test_tools.py
test_parse_edid_descriptor_display_name
168
null
BoboTiG/python-mss
import itertools from collections.abc import Callable from pathlib import Path import pytest from mss.base import MSSBase Image = pytest.importorskip("PIL.Image", reason="PIL module not available.") def test_pil(mss_impl: Callable[..., MSSBase]) -> None: width, height = 16, 16 box = {"top": 0, "left": 0, "w...
"RGB"
assert
string_literal
src/tests/third_party/test_pil.py
test_pil
23
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
TypeError)
pytest.raises
variable
src/tests/test_implementation.py
test_incomplete_class
61
null
BoboTiG/python-mss
from __future__ import annotations import threading import pytest import mss def test_region_not_caching() -> None: """The region to grab is not bad cached previous grab.""" grab1 = mss.mss() grab2 = mss.mss() assert isinstance(grab1, mss.windows.MSS) # For Mypy assert isinstance(grab2, mss.wi...
dib2
assert
variable
src/tests/test_windows.py
test_region_not_caching
55
null
BoboTiG/python-mss
import os from collections.abc import Callable, Generator from hashlib import sha256 from pathlib import Path from platform import system from zipfile import ZipFile import pytest from mss import mss from mss.base import MSSBase from mss.linux import xcb, xlib def _no_warnings(recwarn: pytest.WarningsRecorder) -> Ge...
"d86ed4366d5a882cfe1345de82c87b81aef9f9bf085f4c42acb6f63f3967eccd"
assert
string_literal
src/tests/conftest.py
raw
69
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
repr(ref)
assert
func_call
src/tests/test_implementation.py
test_repr
76
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
xcb.Atom(100)
assert
func_call
src/tests/test_xcb.py
test_cache_miss_calls_xcb_and_caches_result
TestInternAtom
265
null
BoboTiG/python-mss
import ctypes.util import platform from unittest.mock import patch import pytest import mss from mss.exception import ScreenShotError import mss.darwin def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None: # No `CoreGraphics` library version = float(".".join(platform.mac_ver()[0].split(".")[:2])...
modified["width"]
assert
complex_expr
src/tests/test_macos.py
test_implementation
64
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
[1, 2, 3]
assert
collection
src/tests/test_xcb.py
test_list_from_xcb_keeps_parent_alive_until_items_drop
109
null
BoboTiG/python-mss
import itertools from collections.abc import Callable import pytest from mss.base import MSSBase, ScreenShot from mss.exception import ScreenShotError def test_grab_part_of_screen(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: for width, height in itertools.product(range(1, 42), range...
width
assert
variable
src/tests/test_get_pixels.py
test_grab_part_of_screen
31
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
None
assert
none_literal
src/tests/test_xcb.py
test_only_if_exists_returns_none_when_missing
TestInternAtom
279
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
mss.linux.xshmgetimage.ShmStatus.AVAILABLE
assert
complex_expr
src/tests/test_gnu_linux.py
test_shm_available
297
null
BoboTiG/python-mss
from collections.abc import Callable from datetime import datetime from pathlib import Path import pytest from mss.base import MSSBase def test_output_format_date_custom(mss_impl: Callable[..., MSSBase]) -> None: fmt = "sct_{date:%Y-%m-%d}.png" with mss_impl() as sct: filename = sct.shot(mon=1, outpu...
fmt.format(date=datetime.now(tz=UTC))
assert
func_call
src/tests/test_save.py
test_output_format_date_custom
82
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
xcb.Atom(1)
assert
func_call
src/tests/test_xcb.py
test_predefined_atom_skips_xcb
TestInternAtom
258
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
(ScreenShotError, ValueError))
pytest.raises
collection
src/tests/test_gnu_linux.py
test_factory_systems
90
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
"STRSERIAL"
assert
string_literal
src/tests/test_tools.py
test_parse_edid_descriptor_string_serial_overrides_integer
173
null
BoboTiG/python-mss
import itertools from collections.abc import Callable import pytest from mss.base import MSSBase, ScreenShot from mss.exception import ScreenShotError def test_get_pixel(raw: bytes) -> None: image = ScreenShot.from_size(bytearray(raw), 1024, 768) assert image.width == 1024 assert image.height == 768 ...
(0, 0, 0)
assert
collection
src/tests/test_get_pixels.py
test_get_pixel
43
null
BoboTiG/python-mss
from __future__ import annotations import gc import platform from ctypes import ( POINTER, Structure, addressof, c_int, c_void_p, cast, pointer, sizeof, ) from types import SimpleNamespace from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import...
["parent"]
assert
collection
src/tests/test_xcb.py
test_depends_on_defers_parent_teardown_until_child_collected
61
null
BoboTiG/python-mss
import itertools from collections.abc import Callable from pathlib import Path import pytest from mss.base import MSSBase Image = pytest.importorskip("PIL.Image", reason="PIL module not available.") def test_pil(mss_impl: Callable[..., MSSBase]) -> None: width, height = 16, 16 box = {"top": 0, "left": 0, "w...
sct_img.size
assert
complex_expr
src/tests/third_party/test_pil.py
test_pil
24
null
BoboTiG/python-mss
from collections.abc import Callable from mss.base import MSSBase def test_dimensions(mss_impl: Callable[..., MSSBase]) -> None: with mss_impl() as sct: mon = sct.monitors[1] assert mon["width"] >
0
assert
numeric_literal
src/tests/test_find_monitors.py
test_dimensions
36
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
ScreenShotError)
pytest.raises
variable
src/tests/test_implementation.py
test_factory_unknown_system
91
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
ScreenShotError, match=r"\b16\b")
pytest.raises
complex_expr
src/tests/test_gnu_linux.py
test_unsupported_depth
168
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
result
assert
variable
src/tests/test_tools.py
test_parse_edid_manufacture_year_only
133
null
BoboTiG/python-mss
import pytest from mss.base import ScreenShot def test_bad_length() -> None: data = bytearray(b"789c626001000000ffff030000060005") image = ScreenShot.from_size(data, 1024, 768) with pytest.raises(
ValueError, match="attempt to assign")
pytest.raises
complex_expr
src/tests/test_bgra_to_rgb.py
test_bad_length
13
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
0
assert
numeric_literal
src/tests/test_implementation.py
test_entry_point_with_no_argument
226
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
RuntimeError, match="Boom!")
pytest.raises
complex_expr
src/tests/test_gnu_linux.py
test_exception_while_holding_memoryview
343
null
BoboTiG/python-mss
import ctypes.util import platform from unittest.mock import patch import pytest import mss from mss.exception import ScreenShotError import mss.darwin def test_repr() -> None: # CGPoint point = mss.darwin.CGPoint(2.0, 1.0) ref1 = mss.darwin.CGPoint() ref1.x = 2.0 ref1.y = 1.0 assert repr(po...
repr(ref3)
assert
func_call
src/tests/test_macos.py
test_repr
42
null
BoboTiG/python-mss
import ctypes.util import platform from unittest.mock import patch import pytest import mss from mss.exception import ScreenShotError import mss.darwin def test_scaling_on() -> None: """Screnshots are taken at the nominal resolution by default, but scaling can be turned on manually.""" # Grab a 1x1 screensh...
1
assert
numeric_literal
src/tests/test_macos.py
test_scaling_on
80
null
BoboTiG/python-mss
from __future__ import annotations import io import struct from pathlib import Path from typing import TYPE_CHECKING import pytest from mss.tools import parse_edid, to_png WIDTH = 10 HEIGHT = 10 def assert_is_valid_png(*, raw: bytes | None = None, file: Path | None = None) -> None: Image = pytest.importorskip(...
"TST1234"
assert
string_literal
src/tests/test_tools.py
test_parse_edid_basic
127
null
BoboTiG/python-mss
import itertools from collections.abc import Callable from pathlib import Path import pytest from mss.base import MSSBase Image = pytest.importorskip("PIL.Image", reason="PIL module not available.") def test_pil(mss_impl: Callable[..., MSSBase]) -> None: width, height = 16, 16 box = {"top": 0, "left": 0, "w...
sct_img.pixel(x, y)
assert
func_call
src/tests/third_party/test_pil.py
test_pil
27
null
BoboTiG/python-mss
import platform from collections.abc import Callable import pytest from mss.base import MSSBase def test_primary_monitor(mss_impl: Callable[..., MSSBase]) -> None: """Test that primary_monitor property works correctly.""" with mss_impl() as sct: primary = sct.primary_monitor monitors = sct.mo...
primary
assert
variable
src/tests/test_primary_monitor.py
test_primary_monitor
21
null
BoboTiG/python-mss
import ctypes import os import platform import subprocess from collections.abc import Callable import pytest import mss OS = platform.system().lower() PID = os.getpid() def get_opened_socket() -> int: """GNU/Linux: a way to get the opened sockets count. It will be used to check X server connections are well...
original_resources
assert
variable
src/tests/test_leaks.py
test_resource_leaks
125
null
BoboTiG/python-mss
from __future__ import annotations import builtins import ctypes.util import platform from ctypes import CFUNCTYPE, POINTER, _Pointer, c_int from typing import TYPE_CHECKING, Any from unittest.mock import Mock, NonCallableMock, patch import pytest import mss import mss.linux import mss.linux.xcb import mss.linux.xli...
ImportError, match="cannot import name 'WINFUNCTYPE'")
pytest.raises
complex_expr
src/tests/test_gnu_linux.py
test_factory_systems
96
null
BoboTiG/python-mss
from __future__ import annotations import os import platform import sys import threading import time from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import mss from mss.__main__ import main as entry_point from mss.base import...
ret
assert
variable
src/tests/test_implementation.py
_run_main
TestEntryPoint
113
null
miguelgrinberg/microdot
import unittest from microdot.microdot import MultiDict, NoCaseDict class TestMultiDict(unittest.TestCase): def test_case_insensitive_dict(self): d = NoCaseDict() d['One'] = 1 d['one'] = 2 d['ONE'] = 3 d['One'] = 4 d['two'] = 5 self.assertEqual(d['one'], 4)...
5)
self.assertEqual
numeric_literal
tests/test_multidict.py
test_case_insensitive_dict
TestMultiDict
45
null
miguelgrinberg/microdot
import unittest from microdot.microdot import URLPattern class TestURLPattern(unittest.TestCase): def test_custom_url_pattern(self): URLPattern.register_type('hex', '[0-9a-f]+') p = URLPattern('/users/<hex:id>') self.assertEqual(p.match('/users/a1'), {'id': 'a1'}) self.assertIsNone...
{'id': 161})
self.assertEqual
collection
tests/test_url_pattern.py
test_custom_url_pattern
TestURLPattern
136
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.sse import with_sse from microdot.test_client import TestClient class TestWebSocket(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.set_event_loop(asyncio.new_event_loop()) ...
ZeroDivisionError)
self.assertRaises
variable
tests/test_sse.py
test_sse_exception
TestWebSocket
88
null
miguelgrinberg/microdot
import asyncio import os import unittest from microdot import Microdot from microdot.multipart import with_form_data, FileUpload, FormDataIter from microdot.test_client import TestClient class TestMultipart(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio...
200)
self.assertEqual
numeric_literal
tests/test_multipart.py
test_simple_form
TestMultipart
45
null
miguelgrinberg/microdot
import unittest from microdot.microdot import urlencode, urldecode class TestURLEncode(unittest.TestCase): def test_urlencode(self): self.assertEqual(urlencode('?foo=bar&x'),
'%3Ffoo%3Dbar%26x')
self.assertEqual
string_literal
tests/test_urlencode.py
test_urlencode
TestURLEncode
7
null
miguelgrinberg/microdot
import io import sys import unittest from unittest import mock from microdot.wsgi import Microdot, Request class TestWSGI(unittest.TestCase): def start_response(status, headers): self.assertEqual(status,
'200 OK')
self.assertEqual
string_literal
tests/test_wsgi.py
start_response
TestWSGI
50
null
miguelgrinberg/microdot
import asyncio import os import unittest from microdot import Microdot from microdot.multipart import with_form_data, FileUpload, FormDataIter from microdot.test_client import TestClient class TestMultipart(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio...
b'baz')
self.assertEqual
string_literal
tests/test_multipart.py
test_file_save
TestMultipart
158
null
miguelgrinberg/microdot
import asyncio import sys import unittest from microdot import Microdot, Request from microdot.websocket import with_websocket, WebSocket, WebSocketError from microdot.test_client import TestClient class TestWebSocket(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): ...
['hello', b'bye', b'*' * 300, b'+' * 65537])
self.assertEqual
collection
tests/test_websocket.py
test_websocket_echo
TestWebSocket
50
null
miguelgrinberg/microdot
import asyncio import sys import unittest from unittest import mock from microdot.asgi import Microdot, Response class TestASGI(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.set_event_loop(asyncio.new_event_loop()) cls.loop = asyncio.get_event...
b'body')
self.assertEqual
string_literal
tests/test_asgi.py
index
TestASGI
33
null
miguelgrinberg/microdot
import unittest from microdot.microdot import URLPattern class TestURLPattern(unittest.TestCase): def test_int_argument(self): p = URLPattern('/users/<int:id>') self.assertEqual(p.match('/users/123'),
{'id': 123})
self.assertEqual
collection
tests/test_url_pattern.py
test_int_argument
TestURLPattern
70
null
miguelgrinberg/microdot
import unittest from microdot.microdot import MultiDict, NoCaseDict class TestMultiDict(unittest.TestCase): def test_multidict(self): d = MultiDict() self.assertEqual(dict(d), {}) self.assertIsNone(d.get('zero')) self.assertEqual(d.get('zero', default=0),
0)
self.assertEqual
numeric_literal
tests/test_multidict.py
test_multidict
TestMultiDict
11
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.test_client import TestClient from microdot.utemplate import Template Template.initialize('tests/templates') class TestUTemplate(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.s...
b'Hello, foo!\n')
self.assertEqual
string_literal
tests/test_utemplate.py
test_render_template_in_app
TestUTemplate
34
null
miguelgrinberg/microdot
import unittest from microdot.microdot import MultiDict, NoCaseDict class TestMultiDict(unittest.TestCase): def test_case_insensitive_dict(self): d = NoCaseDict() d['One'] = 1 d['one'] = 2 d['ONE'] = 3 d['One'] = 4 d['two'] = 5 self.assertEqual(d['one'],
4)
self.assertEqual
numeric_literal
tests/test_multidict.py
test_case_insensitive_dict
TestMultiDict
41
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.test_client import TestClient from microdot.utemplate import Template Template.initialize('tests/templates') class TestUTemplate(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.s...
'Hello, foo!\n')
self.assertEqual
string_literal
tests/test_utemplate.py
test_render_template
TestUTemplate
22
null
miguelgrinberg/microdot
import asyncio import unittest from microdot.microdot import MultiDict, Request from tests.mock_socket import get_async_request_fd class TestRequest(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.set_event_loop(asyncio.new_event_loop()) cls.loop...
3)
self.assertEqual
numeric_literal
tests/test_request.py
test_headers
TestRequest
49
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.test_client import TestClient from microdot.cors import CORS class TestCORS(unittest.TestCase): def setUpClass(cls): cls.loop = asyncio.new_event_loop() def _run(self, coro): return self.loop.run_until_complete(coro) ...
200)
self.assertEqual
numeric_literal
tests/test_cors.py
test_origin
TestCORS
28
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.test_client import TestClient from microdot.cors import CORS class TestCORS(unittest.TestCase): def setUpClass(cls): cls.loop = asyncio.new_event_loop() def _run(self, coro): return self.loop.run_until_complete(coro) ...
'3600')
self.assertEqual
string_literal
tests/test_cors.py
test_cors_preflight_with_options
TestCORS
148
null
miguelgrinberg/microdot
import asyncio import sys import unittest from microdot import Microdot, Request from microdot.websocket import with_websocket, WebSocket, WebSocketError from microdot.test_client import TestClient class TestWebSocket(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): ...
(None, None))
self.assertEqual
collection
tests/test_websocket.py
test_process_websocket_frame
TestWebSocket
119
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.session import Session, with_session from microdot.test_client import TestClient session_ext = Session(secret_key='866ec558b6c14560bb0930e1fd55068d') class TestSession(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, '...
'bar')
self.assertEqual
string_literal
tests/test_session.py
test_session_default_path
TestSession
113
null
miguelgrinberg/microdot
import unittest from microdot.microdot import URLPattern class TestURLPattern(unittest.TestCase): def test_static(self): p = URLPattern('/') self.assertEqual(p.match('/'),
{})
self.assertEqual
collection
tests/test_url_pattern.py
test_static
TestURLPattern
8
null
miguelgrinberg/microdot
import unittest from microdot.microdot import urlencode, urldecode class TestURLEncode(unittest.TestCase): def test_urldecode(self): self.assertEqual(urldecode('%3Ffoo%3Dbar%26x'), '?foo=bar&x') self.assertEqual(urldecode(b'%3Ffoo%3Dbar%26x'), '?foo=bar&x') self.assertEqual(urldecode('dot...
'dot•dot')
self.assertEqual
string_literal
tests/test_urlencode.py
test_urldecode
TestURLEncode
12
null
miguelgrinberg/microdot
import asyncio import sys import unittest from microdot import Microdot, Request from microdot.websocket import with_websocket, WebSocket, WebSocketError from microdot.test_client import TestClient class TestWebSocket(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): ...
res.body)
self.assertIsNone
complex_expr
tests/test_websocket.py
test_websocket_echo
TestWebSocket
49
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.session import Session, with_session from microdot.test_client import TestClient session_ext = Session(secret_key='866ec558b6c14560bb0930e1fd55068d') class TestSession(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, '...
200)
self.assertEqual
numeric_literal
tests/test_session.py
test_session_no_secret_key
TestSession
85
null
miguelgrinberg/microdot
import asyncio import sys import time import unittest from microdot import Microdot class TestEnd2End(unittest.TestCase): async def request(self, url, method='GET'): while True: reader, writer = await asyncio.open_connection('localhost', 5678) try: writer.write(f'{me...
'HTTP/1.0 200 OK')
self.assertEqual
string_literal
tests/test_end2end.py
run
TestEnd2End
44
null
miguelgrinberg/microdot
import unittest from microdot.microdot import URLPattern class TestURLPattern(unittest.TestCase): def test_static(self): p = URLPattern('/') self.assertEqual(p.match('/'), {}) self.assertIsNone(p.match('/foo')) self.assertIsNone(
p.match('foo'))
self.assertIsNone
func_call
tests/test_url_pattern.py
test_static
TestURLPattern
10
null
miguelgrinberg/microdot
import asyncio import unittest from microdot.microdot import MultiDict, Request from tests.mock_socket import get_async_request_fd class TestRequest(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio.set_event_loop(asyncio.new_event_loop()) cls.loop...
None)
self.assertEqual
none_literal
tests/test_request.py
test_create_request
TestRequest
30
null
miguelgrinberg/microdot
import asyncio import os import unittest from microdot import Microdot from microdot.multipart import with_form_data, FileUpload, FormDataIter from microdot.test_client import TestClient class TestMultipart(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, 'set_event_loop'): asyncio...
{'foo': 'bar', 'x': 'y', 'f': 'f|text/plain|baz', 'g': 'g|text/html|<p>hello</p>'})
self.assertEqual
collection
tests/test_multipart.py
test_form_with_files
TestMultipart
97
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.session import Session, with_session from microdot.test_client import TestClient session_ext = Session(secret_key='866ec558b6c14560bb0930e1fd55068d') class TestSession(unittest.TestCase): def setUpClass(cls): if hasattr(asyncio, '...
'None')
self.assertEqual
string_literal
tests/test_session.py
test_session_async
TestSession
53
null
miguelgrinberg/microdot
import asyncio import unittest from microdot import Microdot from microdot.test_client import TestClient from microdot.cors import CORS class TestCORS(unittest.TestCase): def setUpClass(cls): cls.loop = asyncio.new_event_loop() def _run(self, coro): return self.loop.run_until_complete(coro) ...
'X-Test, X-Test2')
self.assertEqual
string_literal
tests/test_cors.py
test_cors_preflight
TestCORS
119
null