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-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
"parent"
assert
string_literal
tests/commands/test_command.py
test_signature_inheritance
69
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_simple_excepti...
None
assert
none_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_simple_exception
17
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
[foo]
assert
collection
tests/test_application.py
test_add
91
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
"description"
assert
string_literal
tests/commands/test_command.py
test_with_signature
60
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
"help"
assert
string_literal
tests/commands/test_command.py
test_with_signature
61
null
python-poetry/cleo
from __future__ import annotations from cleo.helpers import argument from cleo.helpers import option def test_argument() -> None: arg = argument("foo", "Foo") assert arg.description == "Foo" assert arg.is_required() assert not arg.is_list() assert arg.default is
None
assert
none_literal
tests/test_helpers.py
test_argument
13
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"What time is it, Sébastien? "
assert
string_literal
tests/ui/test_question.py
test_ask_question_with_special_characters
89
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.exceptions import CleoValueError from cleo.ui.choice_question import ChoiceQuestion def test_ask_choice(io: BufferedIO) -> None: io.set_user_input("\n1\n 1 \nJohn\n1\n\nJohn\n1\n0,2\n 0 , 2 \n\n\n4\n0\n-2\n") her...
"Batman"
assert
string_literal
tests/ui/test_choice_question.py
test_ask_choice
28
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
"foo"
assert
string_literal
tests/test_application.py
test_name_version_getters
44
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\nBar\n\x1b[1A\x1b[0J\x1b[1A\x1b[0JBaz\nFoo\n"
assert
string_literal
tests/io/outputs/test_section_output.py
test_clear_with_number_of_lines_and_multiple_sections
58
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_fail_if_name_is_empty() -> None: with pytest.raises(
CleoValueError)
pytest.raises
variable
tests/io/inputs/test_option.py
test_fail_if_name_is_empty
29
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.events.event import Event from cleo.events.event_dispatcher import EventDispatcher def dispatcher() -> EventDispatcher: return EventDispatcher() def listener() -> EventListener: return EventListener() def test_get_...
None
assert
none_literal
tests/events/test_event_dispatcher.py
test_get_listener_priority
109
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
"bar"
assert
string_literal
tests/test_application.py
test_name_version_getters
46
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester def tester() -> CommandTester: ...
"foo bar called\n"
assert
string_literal
tests/testers/test_command_tester.py
test_execute_namespace_command
54
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\nBar\n\x1b[2A\x1b[0JBar\n\x1b[1A\x1b[0JBaz\nBar\n\x1b[1A\x1b[0JFoobar\n"
assert
string_literal
tests/io/outputs/test_section_output.py
test_multiple_sections_output
108
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.helpers import option from cleo.testers.application_tester import ApplicationTes...
"baz\n--baz activated\n"
assert
string_literal
tests/testers/test_application_tester.py
test_execute_namespace_command
86
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.io.outputs.output import Verbosity from cleo.ui.progress_bar import ProgressBar def bar(io: BufferedIO) -> ProgressBar: return ProgressBar(io, min_seconds_between_redraws=0) def ansi_bar(ansi_io: BufferedIO) -> Progress...
ansi_io.fetch_error()
assert
func_call
tests/ui/test_progress_bar.py
test_multiple_start
56
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_nested_excepti...
1
assert
numeric_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_nested_exception
35
null
python-poetry/cleo
from __future__ import annotations from cleo.helpers import argument from cleo.helpers import option def test_argument() -> None: arg = argument("foo", "Foo") assert arg.description == "Foo" assert arg.is_required() assert not arg.is_list() assert arg.default is None arg = argument("foo", "F...
[]
assert
collection
tests/test_helpers.py
test_argument
25
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.ui.table import Table from cleo.ui.table_cell import TableCell from cleo.ui.table_separator import TableSeparator from cleo.ui.table_style import TableStyle books = [ ["99921-58-10-7", "Divine Comedy", "Dante Alighieri"]...
output2
assert
variable
tests/ui/test_table.py
test_style_for_side_effects
483
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo._utils import find_similar_names from cleo._utils import format_time from cleo._utils import strip_tags from cleo._utils import wcswidth from cleo._utils import wcwidth @pytest.mark.parametrize( ["input_secs", "expected"], [ (0.1, "< 1 sec"),...
expected
assert
variable
tests/test_utils.py
test_format_time
29
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
""
assert
string_literal
tests/test_application.py
test_silent_help
120
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
[*source.splitlines(), ""]
assert
collection
tests/ui/test_exception_trace.py
test_docstrings_are_correctly_rendered
319
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_multiple_shortcuts() -> None: opt = Option("option", "-o|oo|-ooo") assert opt.shortcut ==
"o|oo|ooo"
assert
string_literal
tests/io/inputs/test_option.py
test_multiple_shortcuts
58
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
expected
assert
variable
tests/ui/test_exception_trace.py
test_render_debug_better_error_message
76
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
1
assert
numeric_literal
tests/test_application.py
test_all
83
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.exceptions import CleoValueError from cleo.ui.choice_question import ChoiceQuestion def test_ask_choice(io: BufferedIO) -> None: io.set_user_input("\n1\n 1 \nJohn\n1\n\nJohn\n1\n0,2\n 0 , 2 \n\n\n4\n0\n-2\n") her...
["Batman"]
assert
collection
tests/ui/test_choice_question.py
test_ask_choice
53
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_optional_value_with_default() -> None: opt = Option("option", flag=False, requires_value=False, default="Default") assert n...
"Default"
assert
string_literal
tests/io/inputs/test_option.py
test_optional_value_with_default
83
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.io.outputs.output import Verbosity from cleo.ui.progress_bar import ProgressBar def bar(io: BufferedIO) -> ProgressBar: return ProgressBar(io, min_seconds_between_redraws=0) def ansi_bar(ansi_io: BufferedIO) -> Progress...
io.fetch_error()
assert
func_call
tests/ui/test_progress_bar.py
test_non_decorated_output
345
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_recursive_exce...
len(inspector.frames.compact())
assert
func_call
tests/ui/exception_trace/test_inspector.py
test_inspector_with_recursive_exception
50
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_simple_excepti...
"Simple Exception"
assert
string_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_simple_exception
19
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_simple_excepti...
e
assert
variable
tests/ui/exception_trace/test_inspector.py
test_inspector_with_simple_exception
15
null
python-poetry/cleo
from __future__ import annotations import os import pytest from cleo.color import Color @pytest.mark.parametrize( ["foreground", "background", "options", "expected"], [ ("", "", [], " "), ("red", "yellow", [], "\033[31;43m \033[39;49m"), ("red", "yellow", ["underline"], "\033[31;43;4...
expected
assert
variable
tests/test_color.py
test_ansi_colors
23
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.io.inputs.argument import Argument def test_optional_non_list_argument() -> None: argument = Argument( "foo", required=False, is_list=False, description="Foo description", ...
"foo"
assert
string_literal
tests/io/inputs/test_argument.py
test_optional_non_list_argument
18
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.events.event import Event from cleo.events.event_dispatcher import EventDispatcher def dispatcher() -> EventDispatcher: return EventDispatcher() def listener() -> EventListener: return EventListener() def test_add_...
2
assert
numeric_literal
tests/events/test_event_dispatcher.py
test_add_listener
59
null
python-poetry/cleo
from __future__ import annotations import inspect from pathlib import Path from cleo.ui.exception_trace.frame import Frame from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import simple_exception def test_frame() -> None: try: simple_exception() exc...
14
assert
numeric_literal
tests/ui/exception_trace/test_frame.py
test_frame
22
null
python-poetry/cleo
from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest from cleo.io.inputs.argument import Argument from cleo.io.inputs.argv_input import ArgvInput from cleo.io.inputs.definition import Definition from cleo.io.inputs.option import Option def argv() -> Iterator[None]: origi...
{"name": "foo"}
assert
collection
tests/io/inputs/test_argv_input.py
test_parse_arguments
40
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
0
assert
numeric_literal
tests/test_application.py
test_run_with_input
357
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_fail_if_default_value_provided_for_flag() -> None: with pytest.raises(
CleoLogicError)
pytest.raises
variable
tests/io/inputs/test_option.py
test_fail_if_default_value_provided_for_flag
34
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\nBar\nBaz\n\x1b[3A\x1b[0JBar\n"
assert
string_literal
tests/io/outputs/test_section_output.py
test_overwrite_multiple_lines
88
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_simple_excepti...
"ValueError"
assert
string_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_simple_exception
18
null
python-poetry/cleo
from __future__ import annotations import os from typing import TYPE_CHECKING import pytest from cleo.terminal import Terminal def test_size() -> None: terminal = Terminal() w, h = terminal.size assert terminal.width ==
w
assert
variable
tests/test_terminal.py
test_size
19
null
python-poetry/cleo
from __future__ import annotations import os from io import StringIO import pytest from cleo.io.outputs.stream_output import StreamOutput def stream() -> StringIO: return StringIO() @pytest.mark.parametrize( ["env", "is_decorated"], [ ({"NO_COLOR": "1"}, False), ({"FORCE_COLOR": "1"}, ...
expected
assert
variable
tests/io/outputs/test_stream_output.py
test_is_decorated_respects_environment
35
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.events.event import Event from cleo.events.event_dispatcher import EventDispatcher def dispatcher() -> EventDispatcher: return EventDispatcher() def listener() -> EventListener: return EventListener() def test_get_...
expected
assert
variable
tests/events/test_event_dispatcher.py
test_get_all_listeners_sorts_by_priority
97
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.loaders.factory_command_loader import FactoryCommandLoader def command(name: str) -> Command: command_ = Command() command_.name = name return command...
["foo", "bar"]
assert
collection
tests/loaders/test_factory_command_loader.py
test_names
50
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\n\x1b[1A\x1b[0JBar\n"
assert
string_literal
tests/io/outputs/test_section_output.py
test_overwrite
79
null
python-poetry/cleo
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo._compat import WINDOWS from cleo.application import Application from cleo.testers.command_tester import CommandTester from tests.commands.completion.fixtures.command_with_colons import CommandWithColo...
tester.io.fetch_output().replace("\r\n", "\n")
assert
func_call
tests/commands/completion/test_completions_command.py
test_bash
54
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.helpers import option from cleo.testers.application_tester import ApplicationTes...
0
assert
numeric_literal
tests/testers/test_application_tester.py
test_execute
77
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
2
assert
numeric_literal
tests/commands/test_command.py
test_with_signature
62
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
io.fetch_output()
assert
func_call
tests/ui/test_exception_trace.py
test_render_better_error_message
40
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
"Foo"
assert
string_literal
tests/test_application.py
test_name_version_getters
45
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.loaders.factory_command_loader import FactoryCommandLoader def command(name: str) -> Command: command_ = Command() command_.name = name return command...
CleoCommandNotFoundError)
pytest.raises
variable
tests/loaders/test_factory_command_loader.py
test_get_invalid_command_raises_error
41
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.events.event import Event from cleo.events.event_dispatcher import EventDispatcher def dispatcher() -> EventDispatcher: return EventDispatcher() def listener() -> EventListener: return EventListener() def test_get_...
-10
assert
numeric_literal
tests/events/test_event_dispatcher.py
test_get_listener_priority
107
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from cleo.ui.progress_indicator import ProgressIndicator def test_default_indicator(ansi_io: BufferedIO, sleep: Callable[[float], None]) -> None: bar = ProgressIndicator(ansi_io) bar.start("Starting...") sleep(0.101) bar.advance() ...
ansi_io.fetch_error()
assert
func_call
tests/ui/test_progress_indicator.py
test_default_indicator
68
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
foo
assert
variable
tests/test_application.py
test_has_get
110
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_nested_excepti...
"RuntimeError"
assert
string_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_nested_exception
32
null
python-poetry/cleo
from __future__ import annotations import inspect from pathlib import Path from cleo.ui.exception_trace.frame import Frame from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import simple_exception def test_frame_with_no_context_should_return_empty_line() -> None: ...
""
assert
string_literal
tests/ui/exception_trace/test_frame.py
test_frame_with_no_context_should_return_empty_line
47
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
None
assert
none_literal
tests/ui/test_exception_trace.py
test_render_debug_better_error_message_recursion_error
118
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_simple_excepti...
0
assert
numeric_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_simple_exception
20
null
python-poetry/cleo
from __future__ import annotations from cleo.helpers import argument from cleo.helpers import option def test_option() -> None: opt = option("foo", "f", "Foo") assert opt.description == "Foo" assert not opt.accepts_value() assert not opt.requires_value() assert not opt.is_list() assert opt.d...
False
assert
bool_literal
tests/test_helpers.py
test_option
41
null
python-poetry/cleo
from __future__ import annotations from cleo.helpers import argument from cleo.helpers import option def test_argument() -> None: arg = argument("foo", "Foo") assert arg.description == "Foo" assert arg.is_required() assert not arg.is_list() assert arg.default is None arg = argument("foo", "F...
"bar"
assert
string_literal
tests/test_helpers.py
test_argument
19
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.helpers import option from cleo.testers.application_tester import ApplicationTes...
"baz\n--bar activated\n"
assert
string_literal
tests/testers/test_application_tester.py
test_execute
79
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
3
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_async_for
TestAsyncWebSocketIterator
980
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_replace_header(): header_lines = [] update_header_line(header_lines, "content-type", "image/png") assert header_lines == ["content-type: image/png"] update_header_line(header_lines, "Content-Type", "...
["Content-Type: application/json", "Host: example.com"]
assert
collection
tests/unittest/test_headers.py
test_replace_header
36
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
10
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_send_while_receiving
TestAsyncWebSocketConcurrency
636
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_multiple_files(file_server): multipart = CurlMime.from_list( [ { "name": "images", "content_type": "image/j...
2
assert
numeric_literal
tests/unittest/test_upload.py
test_upload_multiple_files
73
null
lexiforest/curl_cffi
import pytest from curl_cffi import CurlHttpVersion, CurlOpt, requests def test_redirect_max(): with pytest.raises(
requests.RequestsError, match="Failed")
pytest.raises
complex_expr
tests/integration/test_httpbin.py
test_redirect_max
33
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_write_function_memory_leak(server): c = Curl() for _ in range(10): url = str(server.url.copy_with(path="/echo_headers")) c....
None
assert
none_literal
tests/unittest/test_curl.py
test_write_function_memory_leak
112
null
lexiforest/curl_cffi
import pytest from curl_cffi import CurlHttpVersion, CurlOpt, requests def test_imperonsate_default_headers(): r = requests.get("http://postman-echo.com/headers", impersonate="chrome110") headers = r.json() assert "Mozilla" in
headers["headers"]["user-agent"]
assert
complex_expr
tests/integration/test_httpbin.py
test_imperonsate_default_headers
40
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_proxy_headers(server): # XXX: only tests that proxy header is not present for target server, should add # tests that verifies proxy headers...
headers
assert
variable
tests/unittest/test_curl.py
test_proxy_headers
92
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
bar
assert
variable
tests/unittest/test_requests.py
test_post_large_body
55
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_http_proxy_changed_path(server): c = Curl() proxy_url = str(server.url).rstrip("/") print("proxy url", proxy_url) c.setopt(CurlOpt....
"http_proxy!"
assert
string_literal
tests/unittest/test_curl.py
test_http_proxy_changed_path
218
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_single_file(file_server): multipart = CurlMime.from_list( [ { "name": "image", "content_type": "image/jpg",...
"image/jpg"
assert
string_literal
tests/unittest/test_upload.py
test_upload_single_file
24
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_header_output(): headers = Headers({"X-Foo": "bar"}) header_list = headers.multi_items() assert header_list[0][0] ==
"X-Foo"
assert
string_literal
tests/unittest/test_headers.py
test_header_output
24
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion def test_impersonate_with_version(server): # the test server does not understand http/2 r = requests.get( str(server.url), impersonate="chrome120", http_version=CurlHttpVersion.V1_1 ) asse...
200
assert
numeric_literal
tests/unittest/test_impersonate.py
test_impersonate_with_version
12
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_replace_header(): header_lines = [] update_header_line(header_lines, "content-type", "image/png") assert header_lines ==
["content-type: image/png"]
assert
collection
tests/unittest/test_headers.py
test_replace_header
30
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
50
assert
numeric_literal
tests/unittest/test_requests.py
test_stream_close_early
980
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_duphandle(server): c = Curl() c.setopt(CurlOpt.URL, str(server.url.copy_with(path="/redirect_loop")).encode()) c.setopt(CurlOpt.FOLLOWL...
CurlError)
pytest.raises
variable
tests/unittest/test_curl.py
test_duphandle
345
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests def test_default_response(): response = requests.get("http://example.com") assert type(response) is
requests.Response
assert
complex_expr
tests/integration/test_response_class.py
test_default_response
7
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
1
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_concurrent_recv_with_connection_close
TestAsyncWebSocketConcurrency
830
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_stream_exclusive(): url = "https://tls.peet.ws/api/all" fp = requests.ExtraFingerprints(http2_stream_exclusive=0) r = requests.get(...
0
assert
numeric_literal
tests/unittest/test_impersonate.py
test_customized_extra_fp_stream_exclusive
256
null
lexiforest/curl_cffi
from curl_cffi.requests import AsyncSession, Session, WebSocket from curl_cffi.requests.websockets import CurlWsFlag def test_hello_twice(ws_server): ws = WebSocket() ws.connect(ws_server.url) ws.send(b"Bar") reply, _ = ws.recv() for _ in range(10): ws.send_str("Bar") reply = ws.r...
"Bar"
assert
string_literal
tests/unittest/test_websockets.py
test_hello_twice
39
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
1
assert
numeric_literal
tests/unittest/test_requests.py
test_content_type_header_with_json
337
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_cert_compression(): url = "https://tls.peet.ws/api/all" fp = requests.ExtraFingerprints(tls_cert_compression="zlib") r = requests.g...
"zlib (1)"
assert
string_literal
tests/unittest/test_impersonate.py
test_customized_extra_fp_cert_compression
240
null
lexiforest/curl_cffi
import asyncio import base64 import json from contextlib import suppress import pytest from curl_cffi import Headers from curl_cffi.requests import AsyncSession, RequestsError from curl_cffi.requests.errors import SessionClosed async def test_not_follow_redirects(server): async with AsyncSession() as s: ...
301
assert
numeric_literal
tests/unittest/test_async_session.py
test_not_follow_redirects
178
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="warning is used") def test_costomized_no_impersonate_coexist(server): with pytest.raises(
requests.RequestsError)
pytest.raises
complex_expr
tests/unittest/test_impersonate.py
test_costomized_no_impersonate_coexist
47
null
lexiforest/curl_cffi
import pytest from curl_cffi import CurlHttpVersion, CurlOpt, requests def test_gzip(): r = requests.get("https://httpbin.org/gzip") assert r.status_code ==
200
assert
numeric_literal
tests/integration/test_httpbin.py
test_gzip
12
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
0
assert
numeric_literal
tests/unittest/test_requests.py
test_not_follow_redirects
447
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_single_file(file_server): multipart = CurlMime.from_list( [ { "name": "image", "content_type": "image/jpg",...
os.path.getsize(ASSET_FOLDER / "scrapfly.png")
assert
func_call
tests/unittest/test_upload.py
test_upload_single_file
25
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
200
assert
numeric_literal
tests/unittest/test_requests.py
test_head
21
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_curl_format_with_hostname(): m = CurlMorsel(name="foo", value="bar", hostname="example.com") assert m.to_curl_format() ==
"example.com\tFALSE\t/\tFALSE\t0\tfoo\tbar"
assert
string_literal
tests/unittest/test_cookies.py
test_curl_format_with_hostname
32
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_referer(server): c = Curl() url = str(server.url.copy_with(path="/echo_headers")) c.setopt(CurlOpt.URL, url.encode()) c.setopt(Curl...
"http://example.org"
assert
string_literal
tests/unittest/test_curl.py
test_referer
259
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_multiple_files_different_name(file_server): multipart = CurlMime.from_list( [ { "name": "image1", "content_...
os.path.getsize(ASSET_FOLDER / "yescaptcha.png")
assert
func_call
tests/unittest/test_upload.py
test_upload_multiple_files_different_name
101
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_stream_weight(): url = "https://tls.peet.ws/api/all" fp = requests.ExtraFingerprints(http2_stream_weight=64) r = requests.get(url, ...
64
assert
numeric_literal
tests/unittest/test_impersonate.py
test_customized_extra_fp_stream_weight
248
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_curl_format_with_hostname(): m = CurlMorsel(name="foo", value="bar", hostname="example.com") assert m.to_curl_format() == "example.com\tFALSE\t/\tFALSE\t0\tfoo\...
"example.com\tFALSE\t/path\tFALSE\t0\tfoo\tbar"
assert
string_literal
tests/unittest/test_cookies.py
test_curl_format_with_hostname
36
null
lexiforest/curl_cffi
import pytest from curl_cffi import CurlHttpVersion, CurlOpt, requests def test_curl_options(): url = "https://postman-echo.com/headers" r = requests.get(url, impersonate="chrome110", default_headers=False) headers = r.json() print(headers) assert r.http_version ==
CurlHttpVersion.V2_0
assert
complex_expr
tests/integration/test_httpbin.py
test_curl_options
55
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests JA3_URL = "https://tls.browserleaks.com/json" CHROME_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" EDGE_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" SAFARI_JA3_HASH = "8468a1ef6cb71b13e1eef8eadf786f7d" def test_not_impersonate(): r = requests.get(JA3_URL) ass...
CHROME_JA3_HASH
assert
variable
tests/integration/test_fingerprints.py
test_not_impersonate
16
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
large
assert
variable
tests/unittest/test_async_websockets.py
test_full_session_lifecycle
TestAsyncWebSocketIntegration
1,263
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_wrapped_headers_preserve_encoding(): headers = Headers({"foo": "bar"}, encoding="utf-8") wrapped_headers = Headers(headers) assert wrapped_headers.encoding ==
"utf-8"
assert
string_literal
tests/unittest/test_headers.py
test_wrapped_headers_preserve_encoding
48
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_headers(server): c = Curl() url = str(server.url.copy_with(path="/echo_headers")) c.setopt(CurlOpt.URL, url.encode()) c.setopt(Curl...
"bar"
assert
string_literal
tests/unittest/test_curl.py
test_headers
70
null