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
python-escpos/python-escpos
import logging import pytest def test_open_raise_exception(networkprinter, devicenotfounderror): """ GIVEN a network printer object WHEN open() is set to raise a DeviceNotFoundError on error THEN check the exception is raised """ networkprinter.host = "fakehost" with pytest.raises(
devicenotfounderror)
pytest.raises
variable
test/test_printers/test_printer_network.py
test_open_raise_exception
33
null
python-escpos/python-escpos
import escpos.printer as printer from escpos.constants import GS def test_cut_without_feed() -> None: """Test cut without feeding paper""" instance = printer.Dummy() instance.cut(feed=False) expected = GS + b"V" + bytes((66,)) + b"\x00" assert instance.output ==
expected
assert
variable
test/test_functions/test_function_cut.py
test_cut_without_feed
10
null
python-escpos/python-escpos
from abc import ABCMeta import pytest import escpos.escpos as escpos def test_abstract_base_class_raises() -> None: """test whether the abstract base class raises an exception for ESC/POS""" with pytest.raises(
TypeError)
pytest.raises
variable
test/test_abstract_base_class.py
test_abstract_base_class_raises
19
null
python-escpos/python-escpos
import pytest from PIL import Image import escpos.printer as printer from escpos.exceptions import ImageWidthError def test_graphics_black() -> None: """ Test printing solid black graphics """ instance = printer.Dummy() instance.image("test/resources/canvas_black.png", impl="graphics") assert...
b"\x1d(L\x0b\x000p0\x01\x011\x01\x00\x01\x00\x80\x1d(L\x02\x0002"
assert
string_literal
test/test_functions/test_function_image.py
test_graphics_black
108
null
python-escpos/python-escpos
import hypothesis.strategies as st import mock from hypothesis import given from escpos.printer import Dummy def get_printer() -> Dummy: return Dummy(magic_encode_args={"disabled": True, "encoding": "CP437"}) def test_block_text() -> None: printer = get_printer() printer.block_text( "All the pres...
b"All the presidents men were eating falafel\nfor breakfast."
assert
string_literal
test/test_functions/test_function_text.py
test_block_text
36
null
python-escpos/python-escpos
import warnings import mock import pytest from PIL import Image from escpos.printer import Dummy @mock.patch("escpos.printer.Dummy.image", spec=Dummy) def test_parameter_image_arguments_passed_to_image_function(img_function): """Test the parameter passed to non-native qr printing.""" d = Dummy() d.qr( ...
"bitImageColumn"
assert
string_literal
test/test_functions/test_function_qr_non-native.py
test_parameter_image_arguments_passed_to_image_function
71
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform == "win32", reason="skipping non Windows platform specific tests" ) def test_open(cupsprinter, caplog, mocker) -> None: """ GIVEN a cups printer object and a mocked pycups device WHEN a valid connection to a device ...
cupsprinter.printers
assert
complex_expr
test/test_printers/test_printer_cups.py
test_open
68
null
python-escpos/python-escpos
import escpos.printer as printer def test_function_linedisplay_select_on() -> None: """test the linedisplay_select function (activate)""" instance = printer.Dummy() instance.linedisplay_select(select_display=True) assert instance.output ==
b"\x1B\x3D\x02"
assert
string_literal
test/test_functions/test_function_linedisplay.py
test_function_linedisplay_select_on
18
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform != "win32", reason="Skipping Windows platform specific tests" ) def test_open_not_raise_exception(win32rawprinter, caplog): """ GIVEN a win32raw printer object WHEN open() is set to not raise on error but simply can...
caplog.text
assert
complex_expr
test/test_printers/test_printer_win32raw.py
test_open_not_raise_exception
54
null
python-escpos/python-escpos
from typing import List from escpos.image import EscposImage def test_split() -> None: """ test whether the split-function works as expected """ im = EscposImage("test/resources/black_white.png") (upper_part, lower_part) = im.split(1) upper_part = EscposImage(upper_part) lower_part = Escpo...
lower_part.height
assert
complex_expr
test/test_image.py
test_split
60
null
python-escpos/python-escpos
import pytest import escpos.printer as printer from escpos.constants import QR_ECLEVEL_H, QR_MODEL_1 def test_defaults() -> None: """Test QR code with defaults""" instance = printer.Dummy() instance.qr("1234", native=True) expected = ( b"\x1d(k\x04\x001A2\x00\x1d(k\x03\x001C\x03\x1d(k\x03\x001...
expected
assert
variable
test/test_functions/test_function_qr_native.py
test_defaults
25
null
python-escpos/python-escpos
import pytest from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile def profile(): return get_profile("default") class TestCustomProfile: def test_columns(self): assert Profile(columns=10).get_columns("sdfasdf") ==
10
assert
numeric_literal
test/test_profile.py
test_columns
TestCustomProfile
34
null
python-escpos/python-escpos
import pytest import escpos.printer as printer from escpos.constants import QR_ECLEVEL_H, QR_MODEL_1 def instance(): return printer.Dummy() def test_center_not_implementer(instance: printer.Dummy) -> None: with pytest.raises(
NotImplementedError)
pytest.raises
variable
test/test_functions/test_function_qr_native.py
test_center_not_implementer
102
null
python-escpos/python-escpos
import escpos.printer as printer def test_function_linedisplay_clear() -> None: """test the linedisplay_clear function""" instance = printer.Dummy() instance.linedisplay_clear() assert instance.output ==
b"\x1B\x40"
assert
string_literal
test/test_functions/test_function_linedisplay.py
test_function_linedisplay_clear
32
null
python-escpos/python-escpos
import types import typing import hypothesis.strategies as st import pytest from hypothesis import example, given from escpos import printer from escpos.exceptions import Error from escpos.katakana import encode_katakana from escpos.magicencode import Encoder, MagicEncode class TestKatakana: def test_result(sel...
b"\xb1\xb2\xb3\xb4\xb5"
assert
string_literal
test/test_magicencode.py
test_result
TestKatakana
133
null
python-escpos/python-escpos
import warnings import mock import pytest from PIL import Image from escpos.printer import Dummy @mock.patch("escpos.printer.Dummy.image", spec=Dummy) def test_parameter_image_arguments_passed_to_image_function(img_function): """Test the parameter passed to non-native qr printing.""" d = Dummy() d.qr( ...
kwargs
assert
variable
test/test_functions/test_function_qr_non-native.py
test_parameter_image_arguments_passed_to_image_function
70
null
python-escpos/python-escpos
import os import tempfile import pytest def test_instantiation() -> None: """test the instantiation of a escpos-printer class""" # inject an environment variable that points to an empty capabilities file os.environ["ESCPOS_CAPABILITIES_FILE"] = tempfile.NamedTemporaryFile().name import escpos.printer...
BarcodeTypeError)
pytest.raises
variable
test/test_load_module_missing_capability.py
test_instantiation
28
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform == "win32", reason="skipping non Windows platform specific tests" ) def test_device_not_initialized(cupsprinter) -> None: """ GIVEN a cups printer object WHEN it is not initialized THEN check the device property...
False
assert
bool_literal
test/test_printers/test_printer_cups.py
test_device_not_initialized
28
null
python-escpos/python-escpos
import os import shutil import tempfile from scripttest import TestFileEnvironment as TFE import escpos TEST_DIR = tempfile.mkdtemp() + "/cli-test" DEVFILE_NAME = "testfile" DEVFILE = os.path.join(TEST_DIR, DEVFILE_NAME) CONFIGFILE = "testconfig.yaml" CONFIG_YAML = f""" --- printer: type: file devfile: {D...
result.stdout.strip()
assert
func_call
test/test_cli.py
test_cli_version
TestCLI
78
null
python-escpos/python-escpos
import warnings import mock import pytest from PIL import Image from escpos.printer import Dummy @mock.patch("escpos.printer.Dummy.image", spec=Dummy) def test_parameter_image_arguments_passed_to_image_function(img_function): """Test the parameter passed to non-native qr printing.""" d = Dummy() d.qr( ...
False
assert
bool_literal
test/test_functions/test_function_qr_non-native.py
test_parameter_image_arguments_passed_to_image_function
73
null
python-escpos/python-escpos
import pytest from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile def profile(): return get_profile("default") class TestBaseProfile: def test_get_font(self, profile): with pytest.raises(NotSupported): assert profile.get_font("3") assert profile.get_font...
0
assert
numeric_literal
test/test_profile.py
test_get_font
TestBaseProfile
18
null
python-escpos/python-escpos
import logging import pytest def test_flush(fileprinter, mocker): """ GIVEN a file printer object and a mocked connection WHEN auto_flush is disabled and flush() issued manually THEN check the flush method is called only one time. """ spy = mocker.spy(fileprinter, "flush") mocker.patch("bu...
1
assert
numeric_literal
test/test_printers/test_printer_file.py
test_flush
97
null
python-escpos/python-escpos
import os import shutil import tempfile from scripttest import TestFileEnvironment as TFE import escpos TEST_DIR = tempfile.mkdtemp() + "/cli-test" DEVFILE_NAME = "testfile" DEVFILE = os.path.join(TEST_DIR, DEVFILE_NAME) CONFIGFILE = "testconfig.yaml" CONFIG_YAML = f""" --- printer: type: file devfile: {D...
result.stdout
assert
complex_expr
test/test_cli.py
test_cli_help
TestCLI
72
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform != "win32", reason="Skipping Windows platform specific tests" ) def test_raw(win32rawprinter, mocker): """ GIVEN a win32raw printer object and a mocked win32print device WHEN calling _raw() after a valid connection ...
b"Test error")
assert_*
string_literal
test/test_printers/test_printer_win32raw.py
test_raw
177
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform == "win32", reason="skipping non Windows platform specific tests" ) def test_device_not_initialized(lpprinter): """ GIVEN a lp printer object WHEN it is not initialized THEN check the device property is False ...
False
assert
bool_literal
test/test_printers/test_printer_lp.py
test_device_not_initialized
28
null
python-escpos/python-escpos
import pytest def test_rearrange_into_cols(driver) -> None: """ GIVEN a list of columnable text WHEN the column width is different for each column and some strings exceed the max width THEN check the strings are properly wrapped, truncated and rearranged into some columns """ output = driver._...
[["fits", "row1", "trunc."], ["", "row2", "and"], ["", "", "wrap"]]
assert
collection
test/test_functions/test_function_software_columns.py
test_rearrange_into_cols
25
null
python-escpos/python-escpos
import logging def test_open(usbprinter, caplog, mocker): """ GIVEN a usb printer object and a mocked pyusb device WHEN a valid connection to a device is opened THEN check the success is logged and the device property is set """ mocker.patch("usb.core.find") with caplog.at_level(logging.IN...
caplog.text
assert
complex_expr
test/test_printers/test_printer_usb.py
test_open
73
null
python-escpos/python-escpos
from typing import List from escpos.image import EscposImage def _load_and_check_img( filename: str, width_expected: int, height_expected: int, raster_format_expected: bytes, column_format_expected: List[bytes], ) -> None: """ Load an image, and test whether raster & column formatted outpu...
height_expected
assert
variable
test/test_image.py
_load_and_check_img
77
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform != "win32", reason="Skipping Windows platform specific tests" ) def test_open(win32rawprinter, caplog, mocker): """ GIVEN a win32raw printer object and a mocked win32printer device WHEN a valid connection to a devic...
PyPrinterHANDLE.return_value
assert
complex_expr
test/test_printers/test_printer_win32raw.py
test_open
81
null
python-escpos/python-escpos
import logging import sys import pytest pytestmark = pytest.mark.skipif( sys.platform == "win32", reason="skipping non Windows platform specific tests" ) def test_raw(cupsprinter) -> None: """ GIVEN a cups printer object WHEN passing a byte string to _raw() THEN check the buffer content """ ...
b"Test"
assert
string_literal
test/test_printers/test_printer_cups.py
test_raw
156
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
{ s.value for s in TorrentState if s.is_errored }
assert
collection
tests/test_definitions.py
test_testing_groups
158
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
TaskStatus.QUEUED
assert
complex_expr
tests/test_torrentcreator.py
test_status_enum
105
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
{ s.value for s in TorrentState if s.is_checking }
assert
collection
tests/test_definitions.py
test_testing_groups
155
null
rmartin16/qbittorrent-api
import pytest from qbittorrentapi import Version from tests.conftest import IS_QBT_DEV, api_version_map @pytest.mark.skipif(IS_QBT_DEV, reason="testing devel version of qBittorrent") def test_is_supported(app_version, api_version): assert Version.is_app_version_supported(app_version) is
True
assert
bool_literal
tests/test_version.py
test_is_supported
17
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError def test_session_cookie(app_version): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ) assert cli...
app_version
assert
variable
tests/test_auth.py
test_session_cookie
68
null
rmartin16/qbittorrent-api
import sys from contextlib import suppress from time import sleep import pytest from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import APIError, Conflict409Error from qbittorrentapi.rss import RSSitemsDictionary from tests.utils import check, retry FOL...
NotImplementedError)
pytest.raises
variable
tests/test_rss.py
test_rss_rules
344
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError def test_is_logged_in(): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ) assert client.is_logge...
False
assert
bool_literal
tests/test_auth.py
test_is_logged_in
23
null
rmartin16/qbittorrent-api
from os import environ, path from time import sleep import pytest from qbittorrentapi import APIConnectionError, Client, TorrentDictionary from qbittorrentapi._version_support import ( APP_VERSION_2_API_VERSION_MAP as api_version_map, ) CHECK_TIME = 10 CHECK_SLEEP = 0.25 def setup_environ(): """Set up envi...
(_v,)
assert
collection
tests/utils.py
_do_check
114
null
rmartin16/qbittorrent-api
import pytest from qbittorrentapi import Version from tests.conftest import IS_QBT_DEV, api_version_map @pytest.mark.skipif(IS_QBT_DEV, reason="testing devel version of qBittorrent") def test_latest_version(): expected_latest_api_version = list(api_version_map.values())[-1] expected_latest_app_version = list(...
expected_latest_app_version
assert
variable
tests/test_version.py
test_latest_version
31
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
MethodType
assert
variable
tests/test_torrent.py
test_reannounce_in
465
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
None
assert
none_literal
tests/test_request.py
test_log_in
38
null
rmartin16/qbittorrent-api
import pytest from qbittorrentapi import Version from tests.conftest import IS_QBT_DEV, api_version_map @pytest.mark.skipif(IS_QBT_DEV, reason="testing devel version of qBittorrent") def test_supported_versions(app_version, api_version): assert isinstance(Version.supported_api_versions(), set) assert api_ver...
Version.supported_api_versions()
assert
func_call
tests/test_version.py
test_supported_versions
10
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
TaskStatus.FINISHED
assert
complex_expr
tests/test_torrentcreator.py
test_status_enum
107
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
orig_torrent.hash
assert
complex_expr
tests/test_torrent.py
test_info
25
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_download_limit(client): client.transfer_set_download_limit(limit=2048) assert client.transfer_download_limit() == 2048 client.transfer_setDownloadLimit(limit=3072) assert ...
3072
assert
numeric_literal
tests/test_transfer.py
test_download_limit
74
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
False
assert
bool_literal
tests/test_torrent.py
test_info
40
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError def test_is_logged_in_bad_client(): client = Client( host="asdf", RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ...
APIConnectionError)
pytest.raises
variable
tests/test_auth.py
test_is_logged_in_bad_client
52
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
{s.value for s in iter(TorrentState)}
assert
collection
tests/test_definitions.py
test_testing_groups
145
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
NotFound404Error)
pytest.raises
variable
tests/test_torrentcreator.py
test_delete
137
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_download_limit(client): client.transfer_set_download_limit(limit=2048) assert client.transfer_download_limit() == 2048 client.transfer_setDownloadLimit(limit=3072) assert c...
5120
assert
numeric_literal
tests/test_transfer.py
test_download_limit
79
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_speed_limits_mode(client): assert client.transfer_speed_limits_mode() in {"0", "1"} assert client.transfer.speed_limits_mode in {"0", "1"} original_mode = client.transfer.spee...
"1"
assert
string_literal
tests/test_transfer.py
test_speed_limits_mode
52
null
rmartin16/qbittorrent-api
import errno import platform import sys from time import sleep import pytest import requests from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import ( Conflict409Error, Forbidden403Error, InvalidRequest400Error, TorrentFileError, Torr...
"Ok."
assert
string_literal
tests/test_torrents.py
add_by_filename
137
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
TorrentState
assert
variable
tests/test_definitions.py
test_all_states
82
null
rmartin16/qbittorrent-api
import errno import platform import sys from time import sleep import pytest import requests from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import ( Conflict409Error, Forbidden403Error, InvalidRequest400Error, TorrentFileError, Torr...
Conflict409Error)
pytest.raises
variable
tests/test_torrents.py
test_priority
982
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, CookieList from qbittorrentapi._attrdict import AttrDict from qbittorrentapi._version_support import v from qbittorrentapi.app import ( DirectoryContentList, NetworkInterface, NetworkInterfaceAddressList, NetworkInterfaceList, ) from tests....
all_dotted_methods
assert
variable
tests/test_app.py
test_methods
23
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary @pytest.mark.skipif(sys.version_info < (3, 9), reason="removeprefix not in 3.8") def test_methods(client): namespace = APINames.Transfer all_dotted_methods = set(dir(getattr(client, namespa...
all_dotted_methods
assert
variable
tests/test_transfer.py
test_methods
15
null
rmartin16/qbittorrent-api
import pytest from qbittorrentapi import Version from tests.conftest import IS_QBT_DEV, api_version_map @pytest.mark.skipif(IS_QBT_DEV, reason="testing devel version of qBittorrent") def test_latest_version(): expected_latest_api_version = list(api_version_map.values())[-1] expected_latest_app_version = list(...
expected_latest_api_version
assert
variable
tests/test_version.py
test_latest_version
30
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_download_limit(client): client.transfer_set_download_limit(limit=2048) assert client.transfer_download_limit() == 2048 client.transfer_setDownloadLimit(limit=3072) assert c...
4096
assert
numeric_literal
tests/test_transfer.py
test_download_limit
77
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.sync import SyncMainDataDictionary, SyncTorrentPeersDictionary @pytest.mark.skipif(sys.version_info < (3, 9), reason="removeprefix not in 3.8") def test_methods(client): namespace = APINames.Sync all_dotted_methods = set(dir(get...
all_dotted_methods
assert
variable
tests/test_sync.py
test_methods
15
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
"gibberish"
assert
string_literal
tests/test_torrent.py
test_sync_local
45
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, NotFound404Error from qbittorrentapi.search import ( SearchCategoriesList, SearchJobDictionary, SearchPluginsList, SearchResultsDictionary, SearchStatusesList, ) from tests.conftest import TORRENT2_HASH, TORRENT2_URL from tests.utils im...
"Running"
assert
string_literal
tests/test_search.py
do_test
204
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
all_dotted_methods
assert
variable
tests/test_torrentcreator.py
test_methods
43
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
409
assert
numeric_literal
tests/test_request.py
test_http409
622
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError def test_is_logged_in(): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ) assert client.is_logged...
True
assert
bool_literal
tests/test_auth.py
test_is_logged_in
26
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, CookieList from qbittorrentapi._attrdict import AttrDict from qbittorrentapi._version_support import v from qbittorrentapi.app import ( DirectoryContentList, NetworkInterface, NetworkInterfaceAddressList, NetworkInterfaceList, ) from tests....
app_version
assert
variable
tests/test_app.py
test_version
27
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
1
assert
numeric_literal
tests/test_request.py
test_http_adapter_defaults
743
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
Conflict409Error)
pytest.raises
variable
tests/test_torrent.py
test_priority
139
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
TorrentStates
assert
variable
tests/test_torrent.py
test_state_enum
52
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError @pytest.mark.skipif(sys.version_info < (3, 9), reason="removeprefix not in 3.8") def test_methods(client): namespace = APINames.Authorization all_dotted_methods = set(dir(getattr(clie...
all_dotted_methods
assert
variable
tests/test_auth.py
test_methods
15
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, Client from qbittorrentapi.exceptions import APIConnectionError def test_session_cookie(app_version): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ) assert cli...
client._SID
assert
complex_expr
tests/test_auth.py
test_session_cookie
73
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
display_value
assert
variable
tests/test_definitions.py
test_tracker_status_display
141
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, CookieList from qbittorrentapi._attrdict import AttrDict from qbittorrentapi._version_support import v from qbittorrentapi.app import ( DirectoryContentList, NetworkInterface, NetworkInterfaceAddressList, NetworkInterfaceList, ) from tests....
api_version
assert
variable
tests/test_app.py
test_web_api_version
34
null
rmartin16/qbittorrent-api
import sys from contextlib import suppress from time import sleep import pytest from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import APIError, Conflict409Error from qbittorrentapi.rss import RSSitemsDictionary from tests.utils import check, retry FOL...
client.rss_items()[rss_feed].url
assert
func_call
tests/test_rss.py
test_rss_set_feed_url
160
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.sync import SyncMainDataDictionary, SyncTorrentPeersDictionary def test_sync_maindata_reset(client): client.sync.maindata.delta() assert client.sync.maindata._rid !=
0
assert
numeric_literal
tests/test_sync.py
test_sync_maindata_reset
33
null
rmartin16/qbittorrent-api
from os import environ, path from time import sleep import pytest from qbittorrentapi import APIConnectionError, Client, TorrentDictionary from qbittorrentapi._version_support import ( APP_VERSION_2_API_VERSION_MAP as api_version_map, ) CHECK_TIME = 10 CHECK_SLEEP = 0.25 def setup_environ(): """Set up envi...
_check_func_val
assert
variable
tests/utils.py
_do_check
111
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
{ s.value for s in TorrentState if s.is_uploading }
assert
collection
tests/test_definitions.py
test_testing_groups
149
null
rmartin16/qbittorrent-api
import pytest from qbittorrentapi import Version from tests.conftest import IS_QBT_DEV, api_version_map @pytest.mark.skipif(IS_QBT_DEV, reason="testing devel version of qBittorrent") def test_is_supported(app_version, api_version): assert Version.is_app_version_supported(app_version) is True assert Version.is...
False
assert
bool_literal
tests/test_version.py
test_is_supported
19
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
TaskStatus.RUNNING
assert
complex_expr
tests/test_torrentcreator.py
test_status_enum
106
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
TrackerStatus(status).value
assert
func_call
tests/test_definitions.py
test_tracker_statuses_cmp_int
127
null
rmartin16/qbittorrent-api
import sys from contextlib import suppress from time import sleep import pytest from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import APIError, Conflict409Error from qbittorrentapi.rss import RSSitemsDictionary from tests.utils import check, retry FOL...
client.rss_items()
assert
func_call
tests/test_rss.py
test_rss_rules
351
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
400
assert
numeric_literal
tests/test_request.py
test_http400
557
null
rmartin16/qbittorrent-api
from os import environ import pytest from tests.utils import check @pytest.mark.skipif(environ.get("CI") != "true", reason="not in CI") def test_shutdown(client): client.app.shutdown() with pytest.raises(
AssertionError, match="qBittorrent crashed...")
pytest.raises
complex_expr
tests/test_zzz_last_tests.py
test_shutdown
11
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
TaskStatus.FAILED
assert
complex_expr
tests/test_torrentcreator.py
test_status_enum
104
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_speed_limits_mode(client): assert client.transfer_speed_limits_mode() in {"0", "1"} assert client.transfer.speed_limits_mode in {"0", "1"} original_mode = client.transfer.spee...
"0"
assert
string_literal
tests/test_transfer.py
test_speed_limits_mode
50
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, CookieList from qbittorrentapi._attrdict import AttrDict from qbittorrentapi._version_support import v from qbittorrentapi.app import ( DirectoryContentList, NetworkInterface, NetworkInterfaceAddressList, NetworkInterfaceList, ) from tests....
prefs
assert
variable
tests/test_app.py
test_preferences
57
null
rmartin16/qbittorrent-api
import errno import platform import sys from time import sleep import pytest import requests from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import ( Conflict409Error, Forbidden403Error, InvalidRequest400Error, TorrentFileError, Torr...
TorrentFileError)
pytest.raises
variable
tests/test_torrents.py
test_add_torrent_file_fail
247
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
[ ListEntry({"one": "1"}), ListEntry({"two": "2"}), ListEntry({"three": "3"}), ] + [ListEntry({"four": "4"})]
assert
collection
tests/test_definitions.py
test_list_actions
194
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
123
assert
numeric_literal
tests/test_request.py
test_response_int
294
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary @pytest.mark.skipif_after_api_version("2.3") def test_ban_peers_not_implemented(client): with pytest.raises(
NotImplementedError)
pytest.raises
variable
tests/test_transfer.py
test_ban_peers_not_implemented
111
null
rmartin16/qbittorrent-api
import sys from contextlib import suppress from time import sleep import pytest from qbittorrentapi import APINames from qbittorrentapi._version_support import v from qbittorrentapi.exceptions import APIError, Conflict409Error from qbittorrentapi.rss import RSSitemsDictionary from tests.utils import check, retry FOL...
all_dotted_methods
assert
variable
tests/test_rss.py
test_methods
68
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
NotImplementedError)
pytest.raises
variable
tests/test_torrent.py
test_set_share_limits_not_implemented
194
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary @pytest.mark.skipif_before_api_version("2.3") def test_ban_peers(client): client.transfer_ban_peers(peers="1.1.1.1:8080") assert "1.1.1.1" in
client.app.preferences.banned_IPs
assert
complex_expr
tests/test_transfer.py
test_ban_peers
97
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames from qbittorrentapi.transfer import TransferInfoDictionary def test_info(client): info = client.transfer_info() assert isinstance(info, TransferInfoDictionary) assert "connection_status" in
info
assert
variable
tests/test_transfer.py
test_info
21
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
"1"
assert
string_literal
tests/test_definitions.py
test_list
180
null
rmartin16/qbittorrent-api
import logging import re from os import environ from unittest.mock import MagicMock, PropertyMock import pytest from requests import Response from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE from qbittorrentapi import APINames, Client, exceptions from qbittorrentapi._version_support import v from qbi...
401
assert
numeric_literal
tests/test_request.py
test_http401
570
null
rmartin16/qbittorrent-api
import platform from time import sleep from types import MethodType from unittest.mock import MagicMock import pytest from qbittorrentapi import ( APINames, Conflict409Error, TorrentDictionary, TorrentFilesList, TorrentPieceInfoList, TorrentPropertiesDictionary, TorrentStates, Trackers...
orig_torrent.info
assert
complex_expr
tests/test_torrent.py
test_reannounce_in
464
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi.definitions import APINames from qbittorrentapi.log import LogMainList, LogPeersList @pytest.mark.parametrize("main_func", ["log_main", "log.main"]) def test_log_main_large_id(client, main_func): assert client.func(main_func)(last_known_id=99999999) ==
[]
assert
collection
tests/test_log.py
test_log_main_large_id
32
null
rmartin16/qbittorrent-api
from enum import Enum import pytest from qbittorrentapi._attrdict import AttrDict from qbittorrentapi.definitions import ( Dictionary, List, ListEntry, TorrentState, TrackerStatus, ) torrent_all_states = [ "error", "missingFiles", "uploading", "pausedUP", "stoppedUP", "que...
TorrentState(state).value
assert
func_call
tests/test_definitions.py
test_states_cmp_str
87
null
rmartin16/qbittorrent-api
import sys from pathlib import Path import pytest from qbittorrentapi import APINames from qbittorrentapi.exceptions import NotFound404Error from qbittorrentapi.torrentcreator import ( TaskStatus, TorrentCreatorTaskDictionary, TorrentCreatorTaskStatus, TorrentCreatorTaskStatusList, ) from tests.utils ...
NotImplementedError)
pytest.raises
variable
tests/test_torrentcreator.py
test_add_task_not_implemented
75
null
rmartin16/qbittorrent-api
import sys import pytest from qbittorrentapi import APINames, CookieList from qbittorrentapi._attrdict import AttrDict from qbittorrentapi._version_support import v from qbittorrentapi.app import ( DirectoryContentList, NetworkInterface, NetworkInterfaceAddressList, NetworkInterfaceList, ) from tests....
NotImplementedError)
pytest.raises
variable
tests/test_app.py
test_build_info_not_implemented
49
null