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 |
|---|---|---|---|---|---|---|---|---|---|
tmbo/questionary | import uuid
import pytest
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_legacy_name():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]}
text = "1" + KeyInputs.ENTER + "\r"
result, cli = feed_cli_with_input... | "foo" | assert | string_literal | tests/prompts/test_rawselect.py | test_legacy_name | 17 | null | |
tmbo/questionary | import asyncio
import platform
import pytest
from prompt_toolkit.output import DummyOutput
from pytest import fail
from questionary import text
from questionary.utils import is_prompt_toolkit_3
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def run(inp):
question = text... | 42 | assert | numeric_literal | tests/test_question.py | run | 33 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | "Hello World" | assert | string_literal | tests/prompts/test_common.py | test_print_with_style | 246 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_legacy_name():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]... | "foo" | assert | string_literal | tests/prompts/test_select.py | test_legacy_name | 19 | null | |
tmbo/questionary | import pytest
from questionary.prompt import PromptParameterException
from questionary.prompt import prompt
from tests.utils import patched_prompt
def test_invalid_question_type():
with pytest.raises( | ValueError) | pytest.raises | variable | tests/test_prompt.py | test_invalid_question_type | 40 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | ValueError) | pytest.raises | variable | tests/prompts/test_path.py | test_get_paths_validation | 121 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_advanc... | { "intro": None, "conditional_step": True, "next_question": "questionary", "second_question": "Hello World", } | assert | collection | tests/test_examples.py | test_advanced_workflow_example | 123 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | expected_tokens | assert | variable | tests/prompts/test_common.py | test_prompt_highlight_coexist | 119 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_autoco... | "Polyergus lucidus" | assert | string_literal | tests/test_examples.py | test_autocomplete_example | 103 | null | |
tmbo/questionary | import pytest
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_no_choices_autocomplete():
message = "Pick your poison "
text = "python2\r"
with pytest.raises( | ValueError) | pytest.raises | variable | tests/prompts/test_autocomplete.py | test_no_choices_autocomplete | 23 | null | |
tmbo/questionary | import pytest
from questionary.prompt import PromptParameterException
from questionary.prompt import prompt
from tests.utils import patched_prompt
def test_missing_message():
with pytest.raises( | PromptParameterException) | pytest.raises | variable | tests/test_prompt.py | test_missing_message | 9 | null | |
tmbo/questionary | import uuid
import pytest
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_select_ctr_c():
message = "Foo message"
kwargs = {"choices": ["foo", "bazz"]}
text = KeyInputs.CONTROLC
with pytest.raises( | KeyboardInterrupt) | pytest.raises | variable | tests/prompts/test_rawselect.py | test_select_ctr_c | 113 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_confir... | {"continue": False} | assert | collection | tests/test_examples.py | test_confirm_example | 24 | null | |
tmbo/questionary | import asyncio
import platform
import pytest
from prompt_toolkit.output import DummyOutput
from pytest import fail
from questionary import text
from questionary.utils import is_prompt_toolkit_3
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def run(inp):
inp.send_text(f... | "Hello\nworld" | assert | string_literal | tests/test_question.py | run | 94 | null | |
tmbo/questionary | import pytest
from questionary.prompt import PromptParameterException
from questionary.prompt import prompt
from tests.utils import patched_prompt
def test_print_no_name():
"""'print' type doesn't require a name so it
should not throw PromptParameterException"""
questions = [{"type": "print", "message": "... | {} | assert | collection | tests/test_prompt.py | test_print_no_name | 71 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | 2 | assert | numeric_literal | tests/prompts/test_common.py | test_prompt_highlight_coexist | 136 | null | |
tmbo/questionary | import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_select_first_choice():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]}
text = KeyInputs.SPACE + KeyInputs.ENTER + "\r"
... | ["foo"] | assert | collection | tests/prompts/test_checkbox.py | test_select_first_choice | 25 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | "baz.any" | assert | string_literal | tests/prompts/test_path.py | test_get_paths | 106 | null | |
tmbo/questionary | import re
from prompt_toolkit.validation import ValidationError
from prompt_toolkit.validation import Validator
from tests.utils import feed_cli_with_input
def test_text_validate_with_class():
class SimpleValidator(Validator):
def validate(self, document):
ok = re.match("[01][01][01]", docume... | "001" | assert | string_literal | tests/prompts/test_text.py | test_text_validate_with_class | 52 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | "Invalid input" | assert | string_literal | tests/prompts/test_common.py | test_validator_bool_function_fails | 46 | null | |
tmbo/questionary | import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_submit_empty():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]}
text = KeyInputs.ENTER + "\r"
result, cli = feed_c... | [] | assert | collection | tests/prompts/test_checkbox.py | test_submit_empty | 16 | null | |
tmbo/questionary | import asyncio
import platform
import pytest
from prompt_toolkit.output import DummyOutput
from pytest import fail
from questionary import text
from questionary.utils import is_prompt_toolkit_3
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def run(inp):
inp.send_text("... | "World" | assert | string_literal | tests/test_question.py | run | 84 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from pytest import fail
import questionary
from questionary import form
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def example_form(inp):
return form(
q1=questionary.confirm("Hello?", input=inp, output=DummyOutput()),
... | {"q1": True, "q2": 42} | assert | collection | tests/test_form.py | run | 49 | null | |
tmbo/questionary | from tests.utils import feed_cli_with_input
def test_password_entry():
message = "What is your password"
text = "my password\r"
result, cli = feed_cli_with_input("password", message, text)
assert result == | "my password" | assert | string_literal | tests/prompts/test_password.py | test_password_entry | 10 | null | |
tmbo/questionary | import asyncio
import platform
import pytest
from prompt_toolkit.output import DummyOutput
from pytest import fail
from questionary import text
from questionary.utils import is_prompt_toolkit_3
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def run(inp):
inp.send_text(K... | None | assert | none_literal | tests/test_question.py | run | 20 | null | |
soxoj/maigret | from argparse import Namespace
from typing import Dict, Any
DEFAULT_ARGS: Dict[str, Any] = {
'all_sites': False,
'connections': 100,
'cookie_file': None,
'csv': False,
'db_file': 'resources/data.json',
'debug': False,
'disable_extracting': False,
'disable_recursive_search': False,
'... | ['username'] | assert | collection | tests/test_cli.py | test_args_search_mode | 54 | null | |
soxoj/maigret | import pytest
from maigret.errors import notify_about_errors, CheckError
from maigret.types import QueryResultWrapper
from maigret.result import MaigretCheckResult, MaigretCheckStatus
def test_notify_about_errors():
results = {
'site1': {
'status': MaigretCheckResult(
'', '', ''... | expected_output | assert | variable | tests/test_errors.py | test_notify_about_errors | 58 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | {'dipres8904': 'username'} | assert | collection | tests/test_maigret.py | test_extract_ids_from_url | 96 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | 'test_tag' | assert | string_literal | tests/test_report.py | test_save_xmind_report | 380 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_dialog_adds_site_negative(settings):
# Initialize necessary objects
db =... | False | assert | bool_literal | tests/test_submit.py | test_dialog_adds_site_negative | 277 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_url_extract_main_part():
url_main_part = 'flickr.com/photos/alexaimephotography'
parts = [
['http://', 'https://'... | url_main_part | assert | variable | tests/test_utils.py | test_url_extract_main_part | 82 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.3 | assert | numeric_literal | tests/test_executors.py | test_simple_asyncio_executor | 28 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_is_country_tag():
assert is_country_tag('ru') is | True | assert | bool_literal | tests/test_utils.py | test_is_country_tag | 45 | null | |
soxoj/maigret | from mock import Mock
import pytest
from maigret import search
def site_result_except(server, username, **kwargs):
query = f'id={username}'
server.expect_request('/url', query_string=query).respond_with_data(**kwargs)
@pytest.mark.slow
@pytest.mark.asyncio
async def test_checking_by_status_code(httpserver, l... | False | assert | bool_literal | tests/test_checking.py | test_checking_by_status_code | 24 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | MaigretCheckStatus.ILLEGAL | assert | complex_expr | tests/test_maigret.py | test_maigret_results | 71 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_url_make_profile_url_regexp():
url_main_part = 'flickr.com/photos/{username}'
parts = [
['http://', 'https://'],
... | r'^https?://(www.|m.)?flickr\.com/photos/(.+?)$' | assert | func_call | tests/test_utils.py | test_url_make_profile_url_regexp | 100 | null | |
soxoj/maigret | from maigret.sites import MaigretDatabase, MaigretSite
EXAMPLE_DB = {
'engines': {
"XenForo": {
"presenseStrs": ["XenForo"],
"site": {
"absenceStrs": [
"The specified member cannot be found. Please enter a member's entire name.",
]... | True | assert | bool_literal | tests/test_sites.py | test_has_site_url_or_name | 210 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | { 'tags': ['news', 'social', 'us'], 'checkType': 'status_code', 'presenseStrs': ['totalKarma'], 'disabled': True, 'alexaRank': 17, 'url': 'https://www.reddit.com/user/{username}', 'urlMain': 'https://www.reddit.com/', 'usernameClaimed': 'blue', 'usernameUnclaimed': 'noonewouldeverusethis7', } | assert | collection | tests/test_maigret.py | test_maigret_results | 54 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | {'adbced123': 'yandex_public_id'} | assert | collection | tests/test_maigret.py | test_extract_ids_from_url | 99 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_detect_known_engine(test_db, local_test_db):
# Use the database fixture inst... | "adam" | assert | string_literal | tests/test_submit.py | test_detect_known_engine | 40 | null | |
soxoj/maigret | from mock import Mock
import pytest
from maigret import search
def site_result_except(server, username, **kwargs):
query = f'id={username}'
server.expect_request('/url', query_string=query).respond_with_data(**kwargs)
@pytest.mark.slow
@pytest.mark.asyncio
async def test_checking_by_status_code(httpserver, l... | True | assert | bool_literal | tests/test_checking.py | test_checking_by_status_code | 21 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | 1 | assert | numeric_literal | tests/test_report.py | test_generate_json_simple_report | 338 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_url_extract_main_part_negative():
url_main_part = 'None'
assert URLMatcher.extract_main_part(url_main_part) == | '' | assert | string_literal | tests/test_utils.py | test_url_extract_main_part_negative | 64 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | 'test' | assert | string_literal | tests/test_report.py | test_save_xmind_report | 377 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_detect_known_engine(test_db, local_test_db):
# Use the database fixture inst... | 0 | assert | numeric_literal | tests/test_submit.py | test_detect_known_engine | 51 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_get_match_ratio():
fun = get_match_ratio(["test", "maigret", "username"])
assert fun("test") == | 1 | assert | numeric_literal | tests/test_utils.py | test_get_match_ratio | 146 | null | |
soxoj/maigret | from maigret.errors import CheckError
from maigret.notify import QueryNotifyPrint
from maigret.result import MaigretCheckStatus, MaigretCheckResult
def test_notify_unknown():
n = QueryNotifyPrint(color=False)
result = MaigretCheckResult(
username="test",
status=MaigretCheckStatus.UNKNOWN,
... | "[?] TEST_SITE: Type error: Reason" | assert | string_literal | tests/test_notify.py | test_notify_unknown | 64 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_dialog_replace_site(settings, test_db):
# Initialize necessary objects
d... | 4 | assert | numeric_literal | tests/test_submit.py | test_dialog_replace_site | 211 | null | |
soxoj/maigret | import json
import yarl
import aiohttp
import pytest
from mock import Mock
from tests.conftest import LOCAL_SERVER_PORT
from maigret.activation import ParsingActivator, import_aiohttp_cookies
COOKIES_TXT = """# HTTP Cookie File downloaded with cookies.txt by Genuinous @genuinous
# This file can be used by wget, curl... | 'b' | assert | string_literal | tests/test_activation.py | test_import_aiohttp_cookies | 51 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_check_features_manually_success(settings):
# Setup
db = MaigretDatabase(... | "Found" | assert | string_literal | tests/test_submit.py | test_check_features_manually_success | 83 | null | |
soxoj/maigret | from maigret.sites import MaigretDatabase, MaigretSite
EXAMPLE_DB = {
'engines': {
"XenForo": {
"presenseStrs": ["XenForo"],
"site": {
"absenceStrs": [
"The specified member cannot be found. Please enter a member's entire name.",
]... | 2 | assert | numeric_literal | tests/test_sites.py | test_saving_site_error | 106 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_case_convert_snake_to_camel():
a = 'camel_cased_string'
b = CaseConverter.snake_to_camel(a)
assert b == | 'camelCasedString' | assert | string_literal | tests/test_utils.py | test_case_convert_snake_to_camel | 27 | null | |
soxoj/maigret | from maigret.errors import CheckError
from maigret.notify import QueryNotifyPrint
from maigret.result import MaigretCheckStatus, MaigretCheckResult
def test_notify_available():
n = QueryNotifyPrint(color=False)
assert | "[-] TEST_SITE: Not found!" | assert | string_literal | tests/test_notify.py | test_notify_available | 41 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | MaigretCheckStatus.CLAIMED | assert | complex_expr | tests/test_maigret.py | test_maigret_results | 75 | null | |
soxoj/maigret | import pytest
from maigret.permutator import Permute
def test_gather_strict():
elements = {'a': 1, 'b': 2}
permute = Permute(elements)
result = permute.gather(method="strict")
expected = {
'a_b': 1,
'b_a': 2,
'a-b': 1,
'b-a': 2,
'a.b': 1,
'b.a': 2,
... | expected | assert | variable | tests/test_permutator.py | test_gather_strict | 23 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_case_convert_camel_with_digits_to_snake():
a = 'ignore403'
b = CaseConverter.camel_to_snake(a)
assert b == | 'ignore403' | assert | string_literal | tests/test_utils.py | test_case_convert_camel_with_digits_to_snake | 41 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.5 | assert | numeric_literal | tests/test_executors.py | test_asyncio_progressbar_queue_executor | 60 | null | |
soxoj/maigret | import pytest
from maigret.utils import is_country_tag
@pytest.mark.slow
def test_tags_validity(default_db):
unknown_tags = set()
tags = default_db._tags
for site in default_db.sites:
for tag in filter(lambda x: not is_country_tag(x), site.tags):
if tag not in tags:
un... | set() | assert | func_call | tests/test_data.py | test_tags_validity | 21 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | None | assert | none_literal | tests/test_maigret.py | test_maigret_results | 80 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_is_country_tag():
assert is_country_tag('ru') is True
assert is_country_tag('FR') is True
assert is_country_tag('a1'... | False | assert | bool_literal | tests/test_utils.py | test_is_country_tag | 48 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.6 | assert | numeric_literal | tests/test_executors.py | test_asyncio_progressbar_queue_executor | 66 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.2 | assert | numeric_literal | tests/test_executors.py | test_simple_asyncio_executor | 27 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_case_convert_camel_to_snake():
a = 'SnakeCasedString'
b = CaseConverter.camel_to_snake(a)
assert b == | 'snake_cased_string' | assert | string_literal | tests/test_utils.py | test_case_convert_camel_to_snake | 20 | null | |
soxoj/maigret | import json
import yarl
import aiohttp
import pytest
from mock import Mock
from tests.conftest import LOCAL_SERVER_PORT
from maigret.activation import ParsingActivator, import_aiohttp_cookies
COOKIES_TXT = """# HTTP Cookie File downloaded with cookies.txt by Genuinous @genuinous
# This file can be used by wget, curl... | {'cookies': {'a': 'b'}} | assert | collection | tests/test_activation.py | test_import_aiohttp_cookies | 58 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | 2 | assert | numeric_literal | tests/test_report.py | test_generate_json_ndjson_report | 364 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_dialog_adds_site_positive(settings):
# Initialize necessary objects
db =... | True | assert | bool_literal | tests/test_submit.py | test_dialog_adds_site_positive | 179 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_detect_known_engine(test_db, local_test_db):
# Use the database fixture inst... | 2 | assert | numeric_literal | tests/test_submit.py | test_detect_known_engine | 36 | null | |
soxoj/maigret | import json
import yarl
import aiohttp
import pytest
from mock import Mock
from tests.conftest import LOCAL_SERVER_PORT
from maigret.activation import ParsingActivator, import_aiohttp_cookies
COOKIES_TXT = """# HTTP Cookie File downloaded with cookies.txt by Genuinous @genuinous
# This file can be used by wget, curl... | token2 | assert | variable | tests/test_activation.py | test_vimeo_activation | 37 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | {'123': 'vk_id'} | assert | collection | tests/test_maigret.py | test_extract_ids_from_url | 92 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_check_features_manually_success(settings):
# Setup
db = MaigretDatabase(... | None | assert | none_literal | tests/test_submit.py | test_check_features_manually_success | 139 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | 'Undefined' | assert | string_literal | tests/test_report.py | test_save_xmind_report | 379 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | None | assert | none_literal | tests/test_report.py | test_generate_report_template | 275 | null | |
soxoj/maigret | from maigret.sites import MaigretDatabase, MaigretSite
EXAMPLE_DB = {
'engines': {
"XenForo": {
"presenseStrs": ["XenForo"],
"site": {
"absenceStrs": [
"The specified member cannot be found. Please enter a member's entire name.",
]... | ['3'] | assert | collection | tests/test_sites.py | test_ranked_sites_dict | 143 | null | |
soxoj/maigret | import itertools
import re
from maigret.utils import (
CaseConverter,
is_country_tag,
enrich_link_str,
URLMatcher,
get_dict_ascii_tree,
get_match_ratio,
)
def test_enrich_link_str():
assert enrich_link_str('test') == 'test'
assert | '<a class="auto-link" href="www.flickr.com/photos/alexaimephotography/">www.flickr.com/photos/alexaimephotography/</a>' | assert | string_literal | tests/test_utils.py | test_enrich_link_str | 56 | null | |
soxoj/maigret | from maigret.sites import MaigretDatabase, MaigretSite
EXAMPLE_DB = {
'engines': {
"XenForo": {
"presenseStrs": ["XenForo"],
"site": {
"absenceStrs": [
"The specified member cannot be found. Please enter a member's entire name.",
]... | ['2'] | assert | collection | tests/test_sites.py | test_ranked_sites_dict | 139 | null | |
soxoj/maigret | import copy
import json
import os
import pytest
from io import StringIO
import xmind
from jinja2 import Template
from maigret.report import (
generate_csv_report,
generate_txt_report,
save_xmind_report,
save_html_report,
save_pdf_report,
generate_report_template,
generate_report_context,
... | [] | assert | collection | tests/test_report.py | test_generate_json_simple_report_broken | 352 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | RESULTS_EXAMPLE | assert | variable | tests/test_maigret.py | test_maigret_results | 84 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.4 | assert | numeric_literal | tests/test_executors.py | test_asyncio_progressbar_semaphore_executor | 50 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | False | assert | bool_literal | tests/test_maigret.py | test_self_check_db | 25 | null | |
soxoj/maigret | from argparse import Namespace
from typing import Dict, Any
DEFAULT_ARGS: Dict[str, Any] = {
'all_sites': False,
'connections': 100,
'cookie_file': None,
'csv': False,
'db_file': 'resources/data.json',
'debug': False,
'disable_extracting': False,
'disable_recursive_search': False,
'... | want_args[arg] | assert | complex_expr | tests/test_cli.py | test_args_search_mode | 60 | null | |
soxoj/maigret | import pytest
import asyncio
import logging
from maigret.executors import (
AsyncioSimpleExecutor,
AsyncioProgressbarExecutor,
AsyncioProgressbarSemaphoreExecutor,
AsyncioProgressbarQueueExecutor,
AsyncioQueueGeneratorExecutor,
)
logger = logging.getLogger(__name__)
async def func(n):
await as... | 0.7 | assert | numeric_literal | tests/test_executors.py | test_asyncio_progressbar_queue_executor | 61 | null | |
soxoj/maigret | import asyncio
import copy
import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
)
from maigret.sites import MaigretSite
from maigret.result import MaigretCheckResult, MaigretCheckStatus
from tests.con... | True | assert | bool_literal | tests/test_maigret.py | test_self_check_db | 26 | null | |
soxoj/maigret | import pytest
from unittest.mock import MagicMock, patch
from maigret.submit import Submitter
from aiohttp import ClientSession
from maigret.sites import MaigretDatabase
import logging
@pytest.mark.slow
@pytest.mark.asyncio
async def test_dialog_adds_site_positive(settings):
# Initialize necessary objects
db =... | [] | assert | collection | tests/test_submit.py | test_dialog_adds_site_positive | 185 | null | |
jrobichaud/django-structlog | import asyncio
import logging
import traceback
import uuid
from typing import Any, AsyncGenerator, Awaitable, Generator, Type, cast
from unittest import mock
from unittest.mock import AsyncMock, Mock, patch
import structlog
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.auth.mo... | 500) | self.assertEqual | numeric_literal | test_app/tests/middlewares/test_request.py | test_process_request_error | TestRequestMiddleware | 643 | null |
jrobichaud/django-structlog | from unittest.mock import create_autospec, patch
from django.test import TestCase
from django_structlog import apps, commands
from django_structlog.celery import receivers
class TestAppConfig(TestCase):
def test_celery_enabled(self) -> None:
app = apps.DjangoStructLogConfig(
"django_structlog... | hasattr(app, "_celery_receiver")) | self.assertTrue | func_call | test_app/tests/test_apps.py | test_celery_enabled | TestAppConfig | 23 | null |
jrobichaud/django-structlog | import logging
from typing import Any
import structlog
from django.core.management import BaseCommand, call_command
from django.test import TestCase
from django_extensions.management.utils import (
signalcommand,
)
class TestCommands(TestCase):
def test_command(self) -> None:
class Command(BaseCommand... | record.msg) | self.assertIn | complex_expr | test_app/tests/test_commands.py | test_command | TestCommands | 32 | null |
jrobichaud/django-structlog | import pytest
from ninja.testing import TestClient
from ..ninja_views import router
pytestmark = pytest.mark.django_db
class TestNinjaView:
def test(self, caplog, request_factory):
client = TestClient(router)
response = client.get("/ninja")
assert response.status_code == 200
asser... | 1 | assert | numeric_literal | django_structlog_demo_project/home/tests/test_ninja_views.py | test | TestNinjaView | 15 | null |
jrobichaud/django-structlog | import asyncio
import logging
import traceback
import uuid
from typing import Any, AsyncGenerator, Awaitable, Generator, Type, cast
from unittest import mock
from unittest.mock import AsyncMock, Mock, patch
import structlog
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.auth.mo... | str) | self.assertIsInstance | variable | test_app/tests/middlewares/test_request.py | test_process_request_user_uuid | TestRequestMiddleware | 212 | null |
jrobichaud/django-structlog | from unittest.mock import create_autospec, patch
from django.test import TestCase
from django_structlog import apps, commands
from django_structlog.celery import receivers
class TestAppConfig(TestCase):
def test_command_enabled(self) -> None:
app = apps.DjangoStructLogConfig(
"django_structl... | hasattr(app, "_django_command_receiver")) | self.assertTrue | func_call | test_app/tests/test_apps.py | test_command_enabled | TestAppConfig | 55 | null |
jrobichaud/django-structlog | from unittest.mock import create_autospec, patch
from django.test import TestCase
from django_structlog import apps, commands
from django_structlog.celery import receivers
class TestAppConfig(TestCase):
def test_command_enabled(self) -> None:
app = apps.DjangoStructLogConfig(
"django_structl... | app._django_command_receiver) | self.assertIsNotNone | complex_expr | test_app/tests/test_apps.py | test_command_enabled | TestAppConfig | 56 | null |
jrobichaud/django-structlog | import logging
from django.test import TestCase
from django_structlog import app_settings
class TestAppSettings(TestCase):
def test_request_cancelled_log_level_custom(self) -> None:
settings = app_settings.AppSettings()
with self.settings(DJANGO_STRUCTLOG_REQUEST_CANCELLED_LOG_LEVEL=logging.DEB... | logging.DEBUG) | self.assertEqual | complex_expr | test_app/tests/test_app_settings.py | test_request_cancelled_log_level_custom | TestAppSettings | 29 | null |
jrobichaud/django-structlog | import pytest
from .. import celery
pytestmark = pytest.mark.django_db
class TestCorruptRejectedTask:
def test(self, caplog):
task_id = "11111111-1111-1111-1111-111111111111"
headers = dict(
id=task_id,
task="django_structlog_demo_project.taskapp.celery.rejected_task",
... | 0 | assert | numeric_literal | django_structlog_demo_project/taskapp/tests/test_celery.py | test_other_tasks_not_corrupted | TestCorruptRejectedTask | 73 | null |
jrobichaud/django-structlog | import logging
from typing import Any
import structlog
from django.core.management import BaseCommand, call_command
from django.test import TestCase
from django_extensions.management.utils import (
signalcommand,
)
class TestCommands(TestCase):
def test_nested_command(self) -> None:
class Command(Bas... | command_event_2.msg) | self.assertIn | complex_expr | test_app/tests/test_commands.py | test_nested_command | TestCommands | 71 | null |
jrobichaud/django-structlog | import logging
from typing import Any
import structlog
from django.core.management import BaseCommand, call_command
from django.test import TestCase
from django_extensions.management.utils import (
signalcommand,
)
class TestCommands(TestCase):
def test_nested_command(self) -> None:
class Command(Bas... | command_event_1.msg) | self.assertIn | complex_expr | test_app/tests/test_commands.py | test_nested_command | TestCommands | 68 | null |
jrobichaud/django-structlog | import logging
import time
from signal import SIGTERM
from typing import Any, Optional, Type
from unittest.mock import MagicMock, Mock, call, patch
import structlog
from celery import shared_task
from django.contrib.auth.models import AnonymousUser
from django.dispatch import receiver as django_receiver
from django.te... | task_id) | self.assertEqual | variable | test_app/tests/celery/test_receivers.py | test_signal_bind_extra_task_metadata | TestReceivers | 261 | null |
jrobichaud/django-structlog | import pytest
from django.conf import settings
from django.urls import resolve, reverse
pytestmark = pytest.mark.django_db
def test_redirect():
assert reverse("users:redirect") == | "/users/~redirect/" | assert | string_literal | django_structlog_demo_project/users/tests/test_urls.py | test_redirect | 31 | null | |
jrobichaud/django-structlog | import pytest
from .. import api_views
pytestmark = pytest.mark.django_db
class TestApiView:
def test(self, caplog, request_factory):
response = api_views.home_api_view(request_factory.get("/"))
assert response.status_code == | 200 | assert | numeric_literal | django_structlog_demo_project/home/tests/test_api_views.py | test | TestApiView | 11 | null |
jrobichaud/django-structlog | import pytest
from django.conf import settings
from django.urls import resolve, reverse
pytestmark = pytest.mark.django_db
def test_update():
assert reverse("users:update") == | "/users/~update/" | assert | string_literal | django_structlog_demo_project/users/tests/test_urls.py | test_update | 26 | null | |
jrobichaud/django-structlog | import pytest
from .. import views
pytestmark = pytest.mark.django_db
pytest_plugins = ("pytest_asyncio",)
class TestLogWithStandardLogger:
def test(self):
response = views.log_with_standard_logger(None)
assert response.status_code == | 200 | assert | numeric_literal | django_structlog_demo_project/home/tests/test_views.py | test | TestLogWithStandardLogger | 37 | null |
jrobichaud/django-structlog | import logging
import time
from signal import SIGTERM
from typing import Any, Optional, Type
from unittest.mock import MagicMock, Mock, call, patch
import structlog
from celery import shared_task
from django.contrib.auth.models import AnonymousUser
from django.dispatch import receiver as django_receiver
from django.te... | context) | self.assertDictEqual | variable | test_app/tests/celery/test_receivers.py | test_receiver_task_pre_run | TestReceivers | 214 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.