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 |
|---|---|---|---|---|---|---|---|---|---|
django-extensions/django-extensions | import json
from pathlib import Path
from tempfile import TemporaryDirectory
import pytest
from django.core.management import CommandError, call_command
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django_extensions.management.commands.managestate import (
DEFA... | None | assert | none_literal | tests/management/commands/test_managestate.py | test_dump_states | TestManageState | 83 | null |
django-extensions/django-extensions | import os
import re
import pytest
import inspect
from textwrap import dedent
from django.core.management import call_command
from django.db.models import Model
from django.test import override_settings
from django_extensions.management.commands import shell_plus
def assert_should_models_be_imported(should_be, cli_ar... | True) | assert_* | bool_literal | tests/management/commands/shell_plus_tests/test_shell_plus.py | test_shell_plus_loading_models | 179 | null | |
django-extensions/django-extensions | from typing import Optional, Set # noqa
from django.conf import settings
from django.test.utils import override_settings
from tests.management.commands.shell_plus_tests.test_utils import (
AutomaticShellPlusImportsTestCase,
)
from tests.test_module_in_project_dir import FourthDerivedClass
from tests.testapp.deri... | second or set()) | assert_* | func_call | tests/management/commands/shell_plus_tests/test_import_subclasses.py | assert_imports | ImportSubclassesTestCase | 152 | null |
django-extensions/django-extensions | from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel,
InheritedFromPostWithUniqField,
PostWithUniqField,
ReverseModel,
SecondDummyRelationModel,
ThirdDummyRelationModel,
)
from django_extensions.db.fields ... | list) | self.assertIsInstance | variable | tests/db/fields/test_uniq_field_mixin.py | test__get_fields_returns_list_of_tulpes | UniqFieldMixinTestCase | 68 | null |
django-extensions/django-extensions | from io import StringIO
from django.urls import path
from django.core.management import CommandError, call_command
from django.http import HttpResponse
from django.test import TestCase
from django.test.utils import override_settings
from django.views.generic.base import View
from unittest.mock import Mock, patch
def... | lines[1]) | self.assertIn | complex_expr | tests/management/commands/test_show_urls.py | test_should_show_urls_unsorted_but_same_order_as_found_in_url_patterns | ShowUrlsTests | 69 | null |
django-extensions/django-extensions | import fnmatch
import os
import shutil
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
class CleanPycTests(TestCase):
def setUp(self):
self.project_root = os.path.join("tests", "testapp")
self._settings = os.environ.get("DJANGO_SETTINGS_MODU... | len(pyc_glob) > 0) | self.assertTrue | func_call | tests/test_clean_pyc.py | test_removes_pyc_files | CleanPycTests | 31 | null |
django-extensions/django-extensions | import os
import shutil
from io import StringIO
from tempfile import mkdtemp
from django.conf import settings
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
def test_validate_templates():
out = StringIO()
try:
... | output | assert | variable | tests/management/commands/test_validate_templates.py | test_validate_templates | 21 | null | |
django-extensions/django-extensions | from django.core import mail
from django.core.management import call_command
from django.test import TestCase
from django.test.utils import override_settings
from io import StringIO
from unittest.mock import patch
class EmailNotificationCommandTests(TestCase):
@override_settings(
ADMINS=["foo@bar.com"],
... | "my_script body") | self.assertEqual | string_literal | tests/management/test_email_notifications.py | test_should_notify_if_notification_level_is_greater_than_0 | EmailNotificationCommandTests | 76 | null |
django-extensions/django-extensions | import os
import shutil
from tempfile import mkdtemp
from django.test import TestCase
from django_extensions.management.mysql import parse_mysql_cnf
class ParseMysqlCnfTests(TestCase):
def setUpClass(cls):
cls.tmpdir = mkdtemp()
def tearDownClass(cls):
shutil.rmtree(cls.tmpdir)
def tes... | ("", "", "", "", "")) | self.assertEqual | collection | tests/test_parse_mysql_cnf.py | test_should_return_empty_strings_if_read_default_file_option_is_missing | ParseMysqlCnfTests | 26 | null |
django-extensions/django-extensions | from io import StringIO
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from django.test.utils import override_settings
from unittest.mock import patch
c... | "bar") | self.assertEqual | string_literal | tests/management/commands/test_set_default_site.py | test_should_set_name_and_domain_if_provided | SetDefaultSiteTests | 86 | null |
django-extensions/django-extensions | from django.core.management import call_command
def test_with_length_args(capsys):
length = 20
call_command("generate_password", length=length)
out, err = capsys.readouterr()
assert len(out.rstrip("\n")) == | length | assert | variable | tests/management/commands/test_generate_password.py | test_with_length_args | 16 | null | |
django-extensions/django-extensions | from django.test import SimpleTestCase
from django_extensions.management.modelviz import generate_graph_data, ON_DELETE_COLORS
class ModelVizTests(SimpleTestCase):
def test_on_delete_color_coding(self):
app_labels = ["django_extensions"]
data = generate_graph_data(app_labels, color_code_deletions=... | relation["arrows"]) | self.assertIn | complex_expr | tests/management/test_modelviz.py | test_on_delete_color_coding | ModelVizTests | 48 | null |
django-extensions/django-extensions | import os
import sys
import importlib
from io import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase, override_settings
from django_extensions.management.commands.runscript import (
Command,
BadCustomDirectoryExcept... | Exception) | self.assertRaises | variable | tests/test_runscript.py | test_raises_error_message_on_invalid_script_by_default | InvalidScriptsTests | 128 | null |
django-extensions/django-extensions | from unittest import mock
import pytest
from io import StringIO
from django.conf import settings
from django.apps import apps
from django.test import TestCase
from django_extensions.management.commands.sqldiff import (
SqliteSQLDiff,
Command,
MySQLDiff,
PostgresqlSQLDiff,
)
from tests.testapp.models i... | [("first", "second")]) | self.assertEqual | collection | tests/test_sqldiff.py | test_get_index_together | SqlDiffTests | 92 | null |
django-extensions/django-extensions | import pytest
from django.db import migrations, models
from django.db.migrations.writer import MigrationWriter
from django.test import TestCase
from django.utils.encoding import force_bytes
import django_extensions # noqa
from django_extensions.db.fields import AutoSlugField
from .testapp.models import (
ChildS... | "slug") | self.assertEqual | string_literal | tests/test_autoslug_fields.py | test_slug_argument_priority_no_overwrite_on_add | AutoSlugFieldTest | 196 | null |
django-extensions/django-extensions | from django.test import TestCase
from django_extensions.db.fields.json import dumps, loads, JSONField, JSONDict, JSONList
from .testapp.models import JSONFieldTestModel
class JsonFieldTest(TestCase):
def test_to_python(self):
j_field = JSONField()
self.assertEqual(loads("1"), | j_field.to_python("1")) | self.assertEqual | func_call | tests/test_json_field.py | test_to_python | JsonFieldTest | 121 | null |
django-extensions/django-extensions | import json
import os
import re
import tempfile
from contextlib import contextmanager
from io import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
def assert_looks_like_dotfile(output):
assert output.startswith("digra... | output | assert | variable | tests/management/commands/test_graph_models.py | assert_looks_like_dotfile | 16 | null | |
django-extensions/django-extensions | import string
import pytest
from django.test import TestCase
from .testapp.models import (
RandomCharTestModel,
RandomCharTestModelUnique,
RandomCharTestModelLowercase,
)
from .testapp.models import (
RandomCharTestModelUppercase,
RandomCharTestModelAlpha,
RandomCharTestModelDigits,
)
from .te... | 8 | assert | numeric_literal | tests/test_randomchar_field.py | testRandomCharField | RandomCharFieldTest | 30 | null |
django-extensions/django-extensions | from django.core.management import call_command
from django_extensions.management.commands.export_emails import full_name
import pytest
from tests.testapp.settings import DATABASES
def custom_djsettings(settings):
"""Custom django settings to avoid warnings in stdout"""
settings.TEMPLATE_DEBUG = False
s... | out | assert | variable | tests/management/commands/test_export_emails.py | test_do_export_emails_stdout_end | 48 | null | |
django-extensions/django-extensions | import pytest
from django.db import migrations, models
from django.db.migrations.writer import MigrationWriter
from django.test import TestCase
from django.utils.encoding import force_bytes
import django_extensions # noqa
from django_extensions.db.fields import AutoSlugField
from .testapp.models import (
ChildS... | result) | self.assertIn | variable | tests/test_autoslug_fields.py | test_17_migration | MigrationTest | 309 | null |
django-extensions/django-extensions | import ast
import shutil
import sys
from io import StringIO
from pathlib import Path
from django.core.management import call_command
from django.test import TestCase, override_settings
from .testapp.models import Name, Note, Person, Club
class DumpScriptTests(TestCase):
def setUp(self):
sys.stdout = Str... | 2) | self.assertEqual | numeric_literal | tests/test_dumpscript.py | test_with_datetimefield | DumpScriptTests | 105 | null |
django-extensions/django-extensions | from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel,
InheritedFromPostWithUniqFieldCompat,
PostWithUniqFieldCompat,
ReverseModelCompat,
SecondDummyRelationModel,
ThirdDummyRelationModel,
)
from django_ext... | "b") | self.assertEqual | string_literal | tests/db/fields/test_uniq_field_mixin_compat.py | test_find_unique | UniqFieldMixinCompatTestCase | 161 | null |
django-extensions/django-extensions | import os
import shutil
from django.conf import settings
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
from io import StringIO
from django_extensions.management.commands.sync_s3 import Command
from unittest.mock import M... | CommandError, "AWS_BUCKET_NAME cannot be empty") | self.assertRaisesRegex | complex_expr | tests/management/commands/test_sync_s3.py | test_should_raise_CommandError_if_AWS_BUCKET_NAME_is_set_to_None | SyncS3ExceptionsTests | 66 | null |
django-extensions/django-extensions | from io import StringIO
import pytest
from django.contrib.auth.models import User
from django.core.management import CommandError, call_command
from django_extensions.management.commands.set_fake_passwords import (
DEFAULT_FAKE_PASSWORD,
)
from unittest.mock import Mock, patch
def django_db_setup(django_db_setu... | 1 | assert | numeric_literal | tests/management/commands/test_set_fake_passwords.py | test_without_args | 35 | null | |
django-extensions/django-extensions | from io import StringIO
from django.urls import path
from django.core.management import CommandError, call_command
from django.http import HttpResponse
from django.test import TestCase
from django.test.utils import override_settings
from django.views.generic.base import View
from unittest.mock import Mock, patch
def... | lines[0]) | self.assertIn | complex_expr | tests/management/commands/test_show_urls.py | test_should_show_urls_unsorted_but_same_order_as_found_in_url_patterns | ShowUrlsTests | 66 | null |
django-extensions/django-extensions | import sys
from django.contrib.auth.models import Group, Permission
from django.test import override_settings
from django_extensions.collision_resolvers import (
AppNameCR,
AppsOrderCR,
BaseCR,
PathBasedCR,
)
from tests.collisions.models import Group as Group_Col
from tests.collisions.models import Nam... | note_col) | assert_* | variable | tests/management/commands/shell_plus_tests/test_collision_resolver.py | _assert_models_present_under_names | CRTestCase | 91 | null |
django-extensions/django-extensions | import importlib.util
import os
from io import StringIO
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
from unittest import mock
class ResetDbExceptionsTests(TestCase):
def test_should_raise_CommandError_when_databas... | CommandError, "Unknown database non-existing_database") | self.assertRaisesRegex | complex_expr | tests/management/commands/test_reset_db.py | test_should_raise_CommandError_when_database_does_not_exist | ResetDbExceptionsTests | 16 | null |
django-extensions/django-extensions | import os
from unittest import mock
import logging
import importlib
from django.core.management import (
call_command,
find_commands,
load_command_class,
BaseCommand,
)
from django.test import TestCase
from io import StringIO
from django_extensions.management.modelviz import use_model, generate_graph_... | when) | self.assertEqual | variable | tests/test_management_command.py | test_runjobs_management_command | RunJobsTests | 592 | null |
django-extensions/django-extensions | from io import StringIO
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from django.test.utils import override_settings
from unittest.mock import patch
c... | "test.com") | self.assertEqual | string_literal | tests/management/commands/test_set_default_site.py | test_should_use_domain_as_name_if_system_fqdn_return_domain_and_name_is_not_provided | SetDefaultSiteTests | 66 | null |
django-extensions/django-extensions | import os
from django.core.management import call_command
def test_without_args(capsys, settings):
call_command("notes")
out, err = capsys.readouterr()
print([out])
assert | out | assert | variable | tests/management/commands/test_notes.py | test_without_args | 11 | null | |
django-extensions/django-extensions | from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel,
InheritedFromPostWithUniqField,
PostWithUniqField,
ReverseModel,
SecondDummyRelationModel,
ThirdDummyRelationModel,
)
from django_extensions.db.fields ... | 7) | self.assertEqual | numeric_literal | tests/db/fields/test_uniq_field_mixin.py | test__get_fields_returns_correct_fields | UniqFieldMixinTestCase | 79 | null |
django-extensions/django-extensions | import importlib.util
from io import StringIO
from unittest.mock import MagicMock, Mock, PropertyMock, call, patch
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
UNKOWN_ENGINE = {
"default": {
"ENGINE": "django... | m_stdout.getvalue()) | self.assertEqual | func_call | tests/management/commands/test_drop_test_database.py | test_should_raise_CommandError_if_database_is_unknown | DropTestDatabaseTests | 104 | null |
django-extensions/django-extensions | from unittest import mock
import pytest
from io import StringIO
from django.conf import settings
from django.apps import apps
from django.test import TestCase
from django_extensions.management.commands.sqldiff import (
SqliteSQLDiff,
Command,
MySQLDiff,
PostgresqlSQLDiff,
)
from tests.testapp.models i... | [{"BAR": 2, "foo": 1}]) | self.assertEqual | collection | tests/test_sqldiff.py | test_sqlite_to_dict | SqlDiffTests | 170 | null |
django-extensions/django-extensions | from io import StringIO
from django.core.management import call_command
def test_show_template_tags():
out = StringIO()
call_command("show_template_tags", "--no-color", stdout=out)
output = out.getvalue()
assert "App: django.contrib.admin\n" in | output | assert | variable | tests/management/commands/test_show_template_tags.py | test_show_template_tags | 12 | null | |
django-extensions/django-extensions | import fnmatch
import os
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
class CompilePycTests(TestCase):
def setUp(self):
self.project_root = os.path.join("tests", "testapp")
self._settings = os.environ.get("DJANGO_SETTINGS_MODULE")
... | sorted(output)) | self.assertEqual | func_call | tests/test_compile_pyc.py | test_takes_path | CompilePycTests | 51 | null |
django-extensions/django-extensions | import importlib.util
from io import StringIO
from unittest.mock import MagicMock, Mock, PropertyMock, call, patch
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
UNKOWN_ENGINE = {
"default": {
"ENGINE": "django... | CommandError, "Unknown database unknown") | self.assertRaisesRegex | complex_expr | tests/management/commands/test_drop_test_database.py | test_should_raise_CommandError_if_database_is_unknown | DropTestDatabaseExceptionsTests | 73 | null |
django-extensions/django-extensions | from unittest import mock
import pytest
from io import StringIO
from django.conf import settings
from django.apps import apps
from django.test import TestCase
from django_extensions.management.commands.sqldiff import (
SqliteSQLDiff,
Command,
MySQLDiff,
PostgresqlSQLDiff,
)
from tests.testapp.models i... | [{"bar": 2, "foo": 1}]) | self.assertEqual | collection | tests/test_sqldiff.py | test_mysql_to_dict | SqlDiffTests | 133 | null |
django-extensions/django-extensions | from django.core.management import call_command
from django.test import TestCase
from io import StringIO
from unittest.mock import patch
class FindTemplateTests(TestCase):
@patch("sys.stderr", new_callable=StringIO)
def test_should_print_error_when_template_not_found(self, m_stderr):
call_command("fi... | m_stderr.getvalue()) | self.assertIn | func_call | tests/test_find_template.py | test_should_print_error_when_template_not_found | FindTemplateTests | 19 | null |
django-extensions/django-extensions | from io import StringIO
from django.core.management import call_command, CommandError
from django.contrib.auth.models import User
from django_extensions.management.commands.set_fake_emails import Command
import pytest
def django_db_setup(django_db_setup, django_db_blocker):
"""Load to database a set of users, c... | out | assert | variable | tests/management/commands/test_set_fake_emails.py | test_without_args | 30 | null | |
django-extensions/django-extensions | import logging
import sys
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
from unittest.mock import patch
class RunJobTests(TestCase):
def setUp(self):
sys.stdout = StringIO()
sys.stderr = StringIO()
# Remove old loggers, since uti... | sys.stdout.getvalue()) | self.assertIn | func_call | tests/management/commands/test_runjob.py | test_runs | RunJobTests | 24 | null |
django-extensions/django-extensions | from unittest.mock import patch
from django.core.exceptions import ValidationError
from django.test import TestCase, SimpleTestCase
from django_extensions.validators import (
NoControlCharactersValidator,
NoWhitespaceValidator,
HexValidator,
)
class TestHexValidator(SimpleTestCase):
def test_custom_m... | "code") | self.assertEqual | string_literal | tests/test_validators.py | test_custom_message_and_code | TestHexValidator | 112 | null |
django-extensions/django-extensions | import os
from unittest import mock
import logging
import importlib
from django.core.management import (
call_command,
find_commands,
load_command_class,
BaseCommand,
)
from django.test import TestCase
from io import StringIO
from django_extensions.management.modelviz import use_model, generate_graph_... | "first") | self.assertEqual | string_literal | tests/test_management_command.py | test_keep_first_or_last_instance | MergeModelInstancesTests | 485 | null |
django-extensions/django-extensions | from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel,
InheritedFromPostWithUniqField,
PostWithUniqField,
ReverseModel,
SecondDummyRelationModel,
ThirdDummyRelationModel,
)
from django_extensions.db.fields ... | 9) | self.assertEqual | numeric_literal | tests/db/fields/test_uniq_field_mixin.py | test__get_fields_returns_correct_fields | UniqFieldMixinTestCase | 78 | null |
django-extensions/django-extensions | import ast
import shutil
import sys
from io import StringIO
from pathlib import Path
from django.core.management import call_command
from django.test import TestCase, override_settings
from .testapp.models import Name, Note, Person, Club
class DumpScriptTests(TestCase):
def setUp(self):
sys.stdout = Str... | len(sys.stdout.getvalue())) | self.assertEqual | func_call | tests/test_dumpscript.py | test_replaced_stdout | DumpScriptTests | 34 | null |
django-extensions/django-extensions | import os
import sys
import importlib
from io import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase, override_settings
from django_extensions.management.commands.runscript import (
Command,
BadCustomDirectoryExcept... | expected_path + "\n") | self.assertEqual | complex_expr | tests/test_runscript.py | _execute_script_with_chdir | ChangingDirectoryTests | 201 | null |
django-extensions/django-extensions | import unittest
from unittest.mock import Mock
from django_extensions.management.shells import import_items
class TestImportItems(unittest.TestCase):
def setUp(self):
self.style = Mock()
self.style.ERROR = Mock(return_value="ERROR")
self.style.SQL_COLTYPE = Mock(return_value="SQL_COLTYPE")
... | result) | self.assertIn | variable | tests/management/commands/shell_plus_tests/test_shells.py | test_simple_import | TestImportItems | 14 | null |
django-extensions/django-extensions | import os
from unittest import mock
import logging
import importlib
from django.core.management import (
call_command,
find_commands,
load_command_class,
BaseCommand,
)
from django.test import TestCase
from io import StringIO
from django_extensions.management.modelviz import use_model, generate_graph_... | "two") | self.assertEqual | string_literal | tests/test_management_command.py | test_get_model_to_merge | MergeModelInstancesTests | 451 | null |
django-extensions/django-extensions | import os
import pytest
from unittest.mock import patch
from django.core.management import CommandError, call_command
from django.db import models
from django.test import TestCase, override_settings
from tests import testapp_with_appconfig
MIGRATIONS_DIR = os.path.join(testapp_with_appconfig.__path__[0], "migrations... | CommandError, "Unknown database non-existing_database") | self.assertRaisesRegex | complex_expr | tests/management/commands/test_delete_squashed_migrations.py | test_should_raise_CommandError_when_database_does_not_exist | DeleteSquashedMigrationsExceptionsTests | 101 | null |
pallets/quart | from __future__ import annotations
from base64 import b64encode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.wrappers.base import BaseRequestWebsocket
def test_query_string(http_scope: HTTPScope) -> None:
base_request_websocket = BaseRequestWebsocke... | ["b", "c"] | assert | collection | tests/wrappers/test_base.py | test_query_string | 144 | null | |
pallets/quart | from api import app
from api import TodoIn
async def test_create_todo() -> None:
test_client = app.test_client()
response = await test_client.post("/todos/", json=TodoIn(task="Abc", due=None))
data = await response.get_json()
assert data == | {"id": 1, "task": "Abc", "due": None} | assert | collection | examples/api/tests/test_api.py | test_create_todo | 16 | null | |
pallets/quart | from __future__ import annotations
from io import BytesIO
from typing import Callable
import pytest
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import jsonify
from quart import Quart
from quart import redirect
from quart import request
from quart ... | 200 | assert | numeric_literal | tests/test_testing.py | test_redirect | 296 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | 4 | assert | numeric_literal | tests/wrappers/test_response.py | test_response_make_conditional | 108 | null | |
pallets/quart | from __future__ import annotations
from quart import Quart
from quart.debug import traceback_response
async def test_debug() -> None:
app = Quart(__name__)
async with app.test_request_context("/"):
response = await traceback_response(Exception("Unique error"))
assert response.status_code == 500
... | await response.get_data() | assert | func_call | tests/test_debug.py | test_debug | 13 | null | |
pallets/quart | from __future__ import annotations
from http import HTTPStatus
import pytest
from werkzeug.exceptions import abort
from werkzeug.exceptions import HTTPException
from quart import Response
@pytest.mark.parametrize("status", [400, HTTPStatus.BAD_REQUEST])
def test_abort(status: int | HTTPStatus) -> None:
with py... | HTTPException) | pytest.raises | variable | tests/test_exceptions.py | test_abort | 14 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | 0 | assert | numeric_literal | tests/wrappers/test_response.py | test_response_make_conditional | 107 | null | |
pallets/quart | from __future__ import annotations
from io import BytesIO
from typing import Callable
import pytest
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import jsonify
from quart import Quart
from quart import redirect
from quart import request
from quart ... | "GET" | assert | string_literal | tests/test_testing.py | test_with_usage | 411 | null | |
pallets/quart | from video import app
async def test_auto_video() -> None:
test_client = app.test_client()
response = await test_client.get("/video.mp4")
data = await response.get_data()
assert len(data) == 255_849
response = await test_client.get("/video.mp4", headers={"Range": "bytes=200-1000"})
data = awai... | 801 | assert | numeric_literal | examples/video/tests/test_video.py | test_auto_video | 12 | null | |
pallets/quart | from __future__ import annotations
from base64 import b64encode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.wrappers.base import BaseRequestWebsocket
def test_digest_authorization(http_scope: HTTPScope) -> None:
headers = Headers()
headers["Aut... | "abcd1234" | assert | string_literal | tests/wrappers/test_base.py | test_digest_authorization | 42 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from collections.abc import AsyncGenerator
from typing import NoReturn
from unittest.mock import AsyncMock
import pytest
from hypercorn.typing import HTTPScope
from hypercorn.typing import WebsocketScope
from werkzeug.datastructures import Headers
from werkzeug.except... | [1] | assert | collection | tests/test_app.py | test_test_app | 434 | null | |
pallets/quart | from __future__ import annotations
from http.cookies import SimpleCookie
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.app import Quart
from quart.sessions import SecureCookieSession
from quart.sessions import SecureCookieSessionInterface
from quart.testing import no_o... | interface.get_cookie_path(app) | assert | func_call | tests/test_sessions.py | test_secure_cookie_session_interface_save_session | 53 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from unittest.mock import AsyncMock
from unittest.mock import Mock
import pytest
from hypercorn.typing import ASGIReceiveEvent
from hypercorn.typing import ASGISendEvent
from hypercorn.typing import HTTPScope
from hypercorn.typing import WebsocketScope
from werkzeug.d... | "PASSED" | assert | string_literal | tests/test_asgi.py | test_http_asgi_scope_from_request | 322 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from typing import cast
from unittest.mock import Mock
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import BadRequest
from quart.app import Quart
from quart.ctx import after_this_request
fro... | True | assert | bool_literal | tests/test_ctx.py | test_has_request_context | 108 | null | |
pallets/quart | from __future__ import annotations
from typing import Any
from typing import Callable
import pytest
from quart import Quart
from quart import request
from quart import ResponseReturnValue
from quart.views import MethodView
from quart.views import View
def app() -> Quart:
app = Quart(__name__)
return app
as... | 405 | assert | numeric_literal | tests/test_views.py | test_view | 36 | null | |
pallets/quart | from blog import app
async def test_create_post():
test_client = app.test_client()
response = await test_client.post(
"/create/", form={"title": "Post", "text": "Text"}
)
assert response.status_code == | 302 | assert | numeric_literal | examples/blog/tests/test_blog.py | test_create_post | 9 | null | |
pallets/quart | from __future__ import annotations
from base64 import b64encode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.wrappers.base import BaseRequestWebsocket
@pytest.mark.parametrize(
"method, scheme, host, path, query_string,"
"expected_path, expected... | method | assert | variable | tests/wrappers/test_base.py | test_url_structure | 127 | null | |
pallets/quart | from __future__ import annotations
from typing import cast
import click
import pytest
from quart import abort
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import request
from quart import ResponseReturnValue
from quart import websocket
fr... | None | assert | none_literal | tests/test_blueprints.py | test_blueprint_url_prefix | 65 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from typing import cast
import pytest
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import abort
from quart import jsonify
from quart import Quart
from quart import request
from quart import Response
from quart impo... | "value" | assert | string_literal | tests/test_basic.py | test_make_response_str | 174 | null | |
pallets/quart | from __future__ import annotations
from http.cookies import SimpleCookie
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.app import Quart
from quart.sessions import SecureCookieSession
from quart.sessions import SecureCookieSessionInterface
from quart.testing import no_o... | interface.get_expiration_time(app, session) or "" | assert | func_call | tests/test_sessions.py | test_secure_cookie_session_interface_save_session | 58 | null | |
pallets/quart | from __future__ import annotations
from typing import cast
import click
import pytest
from quart import abort
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import request
from quart import ResponseReturnValue
from quart import websocket
fr... | "child_1" | assert | string_literal | tests/test_blueprints.py | child_teardown1 | 438 | null | |
pallets/quart | from __future__ import annotations
from http.cookies import SimpleCookie
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.app import Quart
from quart.sessions import SecureCookieSession
from quart.sessions import SecureCookieSessionInterface
from quart.testing import no_o... | interface.get_cookie_samesite(app) or "" | assert | func_call | tests/test_sessions.py | test_secure_cookie_session_interface_save_session | 56 | null | |
pallets/quart | from __future__ import annotations
from http import HTTPStatus
import pytest
from werkzeug.exceptions import abort
from werkzeug.exceptions import HTTPException
from quart import Response
@pytest.mark.parametrize("status", [400, HTTPStatus.BAD_REQUEST])
def test_abort(status: int | HTTPStatus) -> None:
with pyt... | 400 | assert | numeric_literal | tests/test_exceptions.py | test_abort | 16 | null | |
pallets/quart | from __future__ import annotations
from http.cookies import SimpleCookie
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.app import Quart
from quart.sessions import SecureCookieSession
from quart.sessions import SecureCookieSessionInterface
from quart.testing import no_o... | None | assert | none_literal | tests/test_sessions.py | test_secure_cookie_session_interface_save_session_no_modification | 76 | null | |
pallets/quart | from __future__ import annotations
import asyncio
import pytest
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import Response
from quart import ResponseReturnValue
from quart import session
from quart import stream_template_string
def app... | "foo" | assert | string_literal | tests/test_templating.py | test_template_tests | 135 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from urllib.parse import urlencode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import RequestEntityTooLarge
from werkzeug.exceptions import RequestTimeout
from quart.testing import no_op_pu... | RequestTimeout) | pytest.raises | variable | tests/wrappers/test_request.py | test_request_get_data_timeout | 107 | null | |
pallets/quart | from __future__ import annotations
import asyncio
import pytest
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import Response
from quart import ResponseReturnValue
from quart import session
from quart import stream_template_string
def app... | "GET / bar" | assert | string_literal | tests/test_templating.py | test_default_template_context | 52 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from io import BytesIO
from pathlib import Path
import pytest
from werkzeug.exceptions import NotFound
from quart import Blueprint
from quart import Quart
from quart import reques... | "/" | assert | string_literal | tests/test_helpers.py | test_url_for | 106 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from typing import cast
import pytest
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import abort
from quart import jsonify
from quart import Quart
from quart import request
from quart import Response
from quart impo... | data | assert | variable | tests/test_basic.py | test_websocket | 213 | null | |
pallets/quart | from __future__ import annotations
from http.cookies import SimpleCookie
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.app import Quart
from quart.sessions import SecureCookieSession
from quart.sessions import SecureCookieSessionInterface
from quart.testing import no_o... | session | assert | variable | tests/test_sessions.py | test_secure_cookie_session_interface_open_session | 39 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from urllib.parse import urlencode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import RequestEntityTooLarge
from werkzeug.exceptions import RequestTimeout
from quart.testing import no_op_pu... | len(valid_headers) | assert | func_call | tests/wrappers/test_request.py | test_request_send_push_promise | 165 | null | |
pallets/quart | from __future__ import annotations
from io import BytesIO
from typing import Callable
import pytest
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import jsonify
from quart import Quart
from quart import redirect
from quart import request
from quart ... | 401 | assert | numeric_literal | tests/test_testing.py | test_middleware | 467 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from io import BytesIO
from pathlib import Path
import pytest
from werkzeug.exceptions import NotFound
from quart import Blueprint
from quart import Quart
from quart import reques... | mtime | assert | variable | tests/test_helpers.py | test_send_file_last_modified | 254 | null | |
pallets/quart | from __future__ import annotations
from io import BytesIO
from typing import Callable
import pytest
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import jsonify
from quart import Quart
from quart import redirect
from quart import request
from quart ... | b"[42]" | assert | string_literal | tests/test_testing.py | test_session_transactions | 394 | null | |
pallets/quart | from __future__ import annotations
from pathlib import Path
from quart.app import Quart
async def test_host_matching() -> None:
app = Quart(__name__, static_folder="./assets", static_url_path="/static")
test_client = app.test_client()
response = await test_client.get("/static/config.cfg")
assert r... | 200 | assert | numeric_literal | tests/test_static_hosting.py | test_host_matching | 14 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from collections.abc import AsyncGenerator
from typing import NoReturn
from unittest.mock import AsyncMock
import pytest
from hypercorn.typing import HTTPScope
from hypercorn.typing import WebsocketScope
from werkzeug.datastructures import Headers
from werkzeug.except... | expected_methods | assert | variable | tests/test_app.py | test_add_url_rule_automatic_options | 126 | null | |
pallets/quart | from __future__ import annotations
from pathlib import Path
from quart.app import Quart
async def test_host_matching() -> None:
app = Quart(__name__, static_folder="./assets", static_url_path="/static")
test_client = app.test_client()
response = await test_client.get("/static/config.cfg")
assert re... | 404 | assert | numeric_literal | tests/test_static_hosting.py | test_host_matching | 20 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from typing import cast
from unittest.mock import Mock
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import BadRequest
from quart.app import Quart
from quart.ctx import after_this_request
fro... | "hello" | assert | string_literal | tests/test_ctx.py | test_after_this_request | 90 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from typing import cast
import pytest
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import abort
from quart import jsonify
from quart import Quart
from quart import request
from quart import Response
from quart impo... | 409 | assert | numeric_literal | tests/test_basic.py | test_generic_error | 145 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | response.headers | assert | complex_expr | tests/wrappers/test_response.py | test_response_make_conditional_not_modified | 165 | null | |
pallets/quart | from __future__ import annotations
from io import BytesIO
from typing import Callable
import pytest
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as WerkzeugResponse
from quart import jsonify
from quart import Quart
from quart import redirect
from quart import request
from quart ... | "bar" | assert | string_literal | tests/test_testing.py | test_files | 254 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from typing import cast
from unittest.mock import Mock
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import BadRequest
from quart.app import Quart
from quart.ctx import after_this_request
fro... | False | assert | bool_literal | tests/test_ctx.py | test_has_request_context | 110 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | [b"abcdef"] | assert | collection | tests/wrappers/test_response.py | test_data_wrapper | 33 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from collections.abc import AsyncGenerator
from typing import NoReturn
from unittest.mock import AsyncMock
import pytest
from hypercorn.typing import HTTPScope
from hypercorn.typing import WebsocketScope
from werkzeug.datastructures import Headers
from werkzeug.except... | AssertionError) | pytest.raises | variable | tests/test_app.py | test_endpoint_overwrite | 50 | null | |
pallets/quart | from __future__ import annotations
from typing import cast
import click
import pytest
from quart import abort
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import request
from quart import ResponseReturnValue
from quart import websocket
fr... | "blueprint" | assert | string_literal | tests/test_blueprints.py | test_blueprint_route | 30 | null | |
pallets/quart | from __future__ import annotations
from base64 import b64encode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from quart.wrappers.base import BaseRequestWebsocket
@pytest.mark.parametrize(
"method, scheme, host, path, query_string,"
"expected_path, expected... | host | assert | variable | tests/wrappers/test_base.py | test_url_structure | 126 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from io import BytesIO
from pathlib import Path
import pytest
from werkzeug.exceptions import NotFound
from quart import Blueprint
from quart import Quart
from quart import reques... | "http:///" | assert | string_literal | tests/test_helpers.py | test_url_for_host_matching | 113 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from collections.abc import AsyncGenerator
from typing import NoReturn
from unittest.mock import AsyncMock
import pytest
from hypercorn.typing import HTTPScope
from hypercorn.typing import WebsocketScope
from werkzeug.datastructures import Headers
from werkzeug.except... | expected.get_data() | assert | func_call | tests/test_app.py | test_make_response | 204 | null | |
pallets/quart | from __future__ import annotations
import asyncio
import pytest
from quart import Blueprint
from quart import g
from quart import Quart
from quart import render_template_string
from quart import Response
from quart import ResponseReturnValue
from quart import session
from quart import stream_template_string
def app... | "foo boo" | assert | string_literal | tests/test_templating.py | test_template_context_processors | 77 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | "max-age=2, no-cache" | assert | string_literal | tests/wrappers/test_response.py | test_response_cache_control | 196 | null | |
pallets/quart | from __future__ import annotations
from collections.abc import AsyncGenerator
from datetime import datetime
from datetime import timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as s... | "max-age=2" | assert | string_literal | tests/wrappers/test_response.py | test_response_cache_control | 194 | null | |
pallets/quart | from __future__ import annotations
import asyncio
from urllib.parse import urlencode
import pytest
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import Headers
from werkzeug.exceptions import RequestEntityTooLarge
from werkzeug.exceptions import RequestTimeout
from quart.testing import no_op_pu... | RequestEntityTooLarge) | pytest.raises | variable | tests/wrappers/test_request.py | test_body_exceeds_max_content_length | 70 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.