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
meilisearch/meilisearch-python
def test_facet_search_with_q(index_with_documents_and_facets): """Tests facet search with a keyword query q.""" response = index_with_documents_and_facets().facet_search("genre", "cartoon", {"q": "dragon"}) assert isinstance(response, dict) assert response["facetHits"][0]["count"] ==
1
assert
numeric_literal
tests/index/test_index_facet_search_meilisearch.py
test_facet_search_with_q
26
null
meilisearch/meilisearch-python
SORTABLE_ATTRIBUTES = ["title", "release_date"] def test_update_sortable_attributes(empty_index): """Tests updating the sortable attributes.""" index = empty_index() response = index.update_sortable_attributes(SORTABLE_ATTRIBUTES) index.wait_for_task(response.task_uid) get_attributes = index.get_so...
len(SORTABLE_ATTRIBUTES)
assert
func_call
tests/settings/test_settings_sortable_attributes_meilisearch.py
test_update_sortable_attributes
18
null
meilisearch/meilisearch-python
import pytest from meilisearch.errors import MeilisearchApiError def test_delete_webhook(client): """Test deleting a webhook.""" # Create a webhook first webhook_data = { "url": "https://example.com/webhook", } created_webhook = client.create_webhook(webhook_data) # Delete the webhoo...
MeilisearchApiError)
pytest.raises
variable
tests/client/test_client_webhooks_meilisearch.py
test_delete_webhook
90
null
meilisearch/meilisearch-python
import pytest from meilisearch.errors import MeilisearchApiError def test_swap_indexes_with_one_that_does_not_exist_with_rename_as_true(client, empty_index): """Tests swap indexes with one that does not exist.""" index = empty_index("index_B") renamed_index_name = "new_index_name" swapTask = client.sw...
renamed_index_name
assert
variable
tests/client/test_client_swap_meilisearch.py
test_swap_indexes_with_one_that_does_not_exist_with_rename_as_true
91
null
meilisearch/meilisearch-python
import pytest from meilisearch.models.task import Task, TaskResults from tests import common def test_get_tasks_default(index_with_documents): """Tests getting the tasks list of an empty index.""" tasks = index_with_documents().get_tasks() assert isinstance(tasks, TaskResults) assert hasattr(tasks, "r...
0
assert
numeric_literal
tests/index/test_index_task_meilisearch.py
test_get_tasks_default
14
null
meilisearch/meilisearch-python
from datetime import datetime import pytest from meilisearch.client import Client from meilisearch.errors import MeilisearchApiError from meilisearch.index import Index from tests import BASE_URL, MASTER_KEY, common @pytest.mark.usefixtures("indexes_sample") def test_get_indexes(client): """Tests getting all ind...
uids
assert
variable
tests/index/test_index.py
test_get_indexes
52
null
meilisearch/meilisearch-python
import pytest from tests.common import BASE_URL, REMOTE_MS_1 from tests.test_utils import reset_network_config @pytest.mark.usefixtures("enable_network_options") def test_update_and_get_network_settings(client): """Test updating and getting network settings.""" instance_name = REMOTE_MS_1 options = { ...
options["remotes"][instance_name]["writeApiKey"]
assert
complex_expr
tests/client/test_client_sharding.py
test_update_and_get_network_settings
31
null
meilisearch/meilisearch-python
import meilisearch def test_is_healthy(client): """Tests checking if is_healthy return true when Meilisearch instance is available.""" response = client.is_healthy() assert response is
True
assert
bool_literal
tests/client/test_client_health_meilisearch.py
test_is_healthy
13
null
meilisearch/meilisearch-python
import pytest from meilisearch.errors import MeilisearchApiError def test_get_webhooks_empty(client): """Test getting webhooks when none exist.""" webhooks = client.get_webhooks() assert webhooks.results is not
None
assert
none_literal
tests/client/test_client_webhooks_meilisearch.py
test_get_webhooks_empty
11
null
meilisearch/meilisearch-python
import pytest import meilisearch from tests import BASE_URL, MASTER_KEY def test_get_client(): """Tests getting a client instance.""" client = meilisearch.Client(BASE_URL, MASTER_KEY) assert client.config response = client.health() assert response["status"] ==
"available"
assert
string_literal
tests/client/test_client.py
test_get_client
14
null
meilisearch/meilisearch-python
FILTERABLE_ATTRIBUTES = ["title", "release_date"] def test_get_filterable_attributes(empty_index): """Tests getting the filterable attributes.""" response = empty_index().get_filterable_attributes() assert response ==
[]
assert
collection
tests/settings/test_settings_filterable_attributes_meilisearch.py
test_get_filterable_attributes
9
null
meilisearch/meilisearch-python
NEW_SEARCHABLE_ATTRIBUTES = ["something", "random"] def test_update_searchable_attributes(empty_index): """Tests updating the searchable attributes.""" index = empty_index() response = index.update_searchable_attributes(NEW_SEARCHABLE_ATTRIBUTES) index.wait_for_task(response.task_uid) response = in...
response
assert
variable
tests/settings/test_settings_searchable_attributes_meilisearch.py
test_update_searchable_attributes
25
null
meilisearch/meilisearch-python
import pytest from meilisearch.models.embedders import ( CompositeEmbedder, HuggingFaceEmbedder, OpenAiEmbedder, PoolingType, UserProvidedEmbedder, ) def test_openai_embedder_format(empty_index): """Tests that OpenAi embedder has the required fields and proper format.""" index = empty_inde...
0.5
assert
numeric_literal
tests/settings/test_settings_embedders.py
test_openai_embedder_format
78
null
meilisearch/meilisearch-python
import json from datetime import datetime from json import JSONEncoder from math import ceil from uuid import UUID, uuid4 from warnings import catch_warnings import pytest from meilisearch.errors import MeilisearchApiError from meilisearch.models.document import Document from meilisearch.models.task import TaskInfo ...
3
assert
numeric_literal
tests/index/test_index_document_meilisearch.py
test_get_documents_offset_optional_params
248
null
meilisearch/meilisearch-python
NEW_DICTIONARY = ["J. R. R. Tolkien", "W. E. B. Du Bois"] def test_get_dictionary_default(empty_index): """Tests getting the default value of user dictionary.""" dictionary = empty_index().get_dictionary() assert dictionary ==
[]
assert
collection
tests/settings/test_settings_dictionary_meilisearch.py
test_get_dictionary_default
7
null
meilisearch/meilisearch-python
from unittest.mock import patch import pytest import requests from meilisearch.errors import MeilisearchApiError, MeilisearchCommunicationError def test_get_chat_workspaces(client): """Test basic get_chat_workspaces functionality.""" mock_response = { "results": [ {"uid": "workspace1", "n...
"chats")
assert_*
string_literal
tests/client/test_chat_completions.py
test_get_chat_workspaces
112
null
meilisearch/meilisearch-python
import meilisearch def test_is_healthy_bad_route(): """Tests checking if is_healthy returns false when trying to reach a bad URL.""" client = meilisearch.Client("http://wrongurl:1234", timeout=1) response = client.is_healthy() assert response is
False
assert
bool_literal
tests/client/test_client_health_meilisearch.py
test_is_healthy_bad_route
20
null
meilisearch/meilisearch-python
NEW_SEARCH_CUTOFF_MS = 150 def test_update_search_cutoff_ms(empty_index): """Tests updating search cutoff in ms.""" index = empty_index() response = index.update_search_cutoff_ms(NEW_SEARCH_CUTOFF_MS) update = index.wait_for_task(response.task_uid) assert update.status ==
"succeeded"
assert
string_literal
tests/settings/test_settings_search_cutoff_meilisearch.py
test_update_search_cutoff_ms
15
null
meilisearch/meilisearch-python
DEFAULT_MAX_TOTAL_HITS = 1000 NEW_MAX_TOTAL_HITS = {"maxTotalHits": 2222} def test_get_pagination_settings(empty_index): response = empty_index().get_pagination_settings() assert DEFAULT_MAX_TOTAL_HITS ==
response.max_total_hits
assert
complex_expr
tests/settings/test_settings_pagination.py
test_get_pagination_settings
8
null
meilisearch/meilisearch-python
import pytest from meilisearch.models.index import Faceting DEFAULT_MAX_VALUE_PER_FACET = 100 DEFAULT_SORT_FACET_VALUES_BY = {"*": "alpha"} NEW_MAX_VALUE_PER_FACET = {"maxValuesPerFacet": 200} def test_get_faceting_settings(empty_index): response = empty_index().get_faceting_settings() assert DEFAULT_MAX_VA...
response.sort_facet_values_by
assert
complex_expr
tests/settings/test_setting_faceting.py
test_get_faceting_settings
14
null
meilisearch/meilisearch-python
import pytest from meilisearch.models.task import TaskInfo from tests import common def create_tasks(empty_index, small_movies): """Ensures there are some tasks present for testing.""" index = empty_index() index.update_ranking_rules(["typo", "exactness"]) index.reset_ranking_rules() index.add_doc...
None
assert
none_literal
tests/client/test_client_task_meilisearch.py
test_cancel_tasks
107
null
meilisearch/meilisearch-python
def test_dump_creation(client, index_with_documents): """Tests the creation of a Meilisearch dump.""" index_with_documents("indexUID-dump-creation") dump = client.create_dump() client.wait_for_task(dump.task_uid) dump_status = client.get_task(dump.task_uid) assert dump_status.status == "succeede...
"dumpCreation"
assert
string_literal
tests/client/test_client_dumps.py
test_dump_creation
11
null
meilisearch/meilisearch-python
from datetime import datetime import pytest from meilisearch.errors import MeilisearchApiError from tests import common def test_get_keys_with_parameters(client): """Tests if search and admin keys have been generated and can be retrieved.""" keys = client.get_keys({"limit": 1}) assert len(keys.results) ...
1
assert
numeric_literal
tests/client/test_client_key_meilisearch.py
test_get_keys_with_parameters
23
null
meilisearch/meilisearch-python
DISPLAYED_ATTRIBUTES = ["id", "release_date", "title", "poster", "overview", "genre"] def test_update_displayed_attributes_to_none(empty_index): """Tests updating the displayed attributes at null.""" index = empty_index() # Update the settings first response = index.update_displayed_attributes(DISPLAYE...
get_attributes
assert
variable
tests/settings/test_settings_displayed_attributes_meilisearch.py
test_update_displayed_attributes_to_none
38
null
meilisearch/meilisearch-python
import pytest from meilisearch.errors import MeilisearchApiError def test_swap_indexes(client, empty_index): """Tests swap two indexes.""" indexA = empty_index("index_A") indexB = empty_index("index_B") taskA = indexA.add_documents([{"id": 1, "title": "index_A"}]) taskB = indexB.add_documents([{"i...
indexA.uid
assert
complex_expr
tests/client/test_client_swap_meilisearch.py
test_swap_indexes
28
null
meilisearch/meilisearch-python
from meilisearch.models.index import IndexStats def test_get_stats(empty_index): """Tests getting stats of an index.""" response = empty_index().get_stats() assert isinstance(response, IndexStats) assert response.number_of_documents ==
0
assert
numeric_literal
tests/index/test_index_stats_meilisearch.py
test_get_stats
8
null
apiflask/apiflask
import pytest from marshmallow import fields from marshmallow import Schema from marshmallow import ValidationError from apiflask.schema_adapters import registry from apiflask.schema_adapters.marshmallow import MarshmallowAdapter class TestMarshmallowAdapter: def test_init_with_schema_instance(self): """...
schema
assert
variable
tests/test_schema_adapters.py
test_init_with_schema_instance
TestMarshmallowAdapter
90
null
apiflask/apiflask
import openapi_spec_validator as osv def test_openapi_fields(app, client): openapi_version = '3.0.2' description = 'My API' tags = [ { 'name': 'foo', 'description': 'some description for foo', 'externalDocs': { 'description': 'Find more info about...
tags
assert
variable
tests/test_settings_openapi_fields.py
test_openapi_fields
43
null
apiflask/apiflask
import openapi_spec_validator as osv from .schemas import Foo from apiflask import HTTPTokenAuth def test_input_on_async_view(app, client): @app.post('/') @app.input(Foo) async def index(json_data): return json_data data = {'id': 1, 'name': 'foo'} rv = client.post('/', json=data) asse...
data
assert
variable
tests/test_async.py
test_input_on_async_view
71
null
apiflask/apiflask
import importlib import openapi_spec_validator as osv import pytest from apiflask import APIBlueprint def test_tags(app, client): assert app.tags is None app.tags = [ { 'name': 'foo', 'description': 'some description for foo', 'externalDocs': { 'des...
'foo'
assert
string_literal
tests/test_openapi_tags.py
test_tags
28
null
apiflask/apiflask
import json import openapi_spec_validator as osv import pytest from flask import request from .schemas import Bar from .schemas import Baz from .schemas import Foo from apiflask import APIBlueprint from apiflask import Schema from apiflask.commands import spec_command from apiflask.fields import Integer def test_spe...
'Foo'
assert
string_literal
tests/test_openapi_basic.py
test_spec_processor
35
null
apiflask/apiflask
import openapi_spec_validator as osv from .schemas import Foo from .schemas import Header from .schemas import Pagination from .schemas import Query def test_parameters_registration(app, client): @app.route('/foo') @app.input(Query, location='query') @app.output(Foo) def foo(query_data): pass ...
1
assert
numeric_literal
tests/test_openapi_paths.py
test_parameters_registration
206
null
apiflask/apiflask
import openapi_spec_validator as osv from flask.views import MethodView from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_blueprint_enable_openapi(app, client): auth = HTTPBasicAuth() @app.get('/hello') @app.auth_required(au...
[]
assert
collection
tests/test_blueprint.py
test_blueprint_enable_openapi
49
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from .schemas import Foo from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_bare_view_base_response_spec(app, client): app.config['BASE_RESPONSE_SCHEMA'] = BaseResponse ...
{'type': 'string'}
assert
collection
tests/test_base_response.py
test_bare_view_base_response_spec
170
null
apiflask/apiflask
import pytest from marshmallow import fields from marshmallow import Schema from marshmallow import ValidationError from apiflask.schema_adapters import registry from apiflask.schema_adapters.marshmallow import MarshmallowAdapter class TestFlaskParser: def test_flask_parser_singleton(self): """Test that ...
parser2
assert
variable
tests/test_schema_adapters.py
test_flask_parser_singleton
TestFlaskParser
244
null
apiflask/apiflask
import json import pytest from .schemas import Foo from .schemas import Qux from apiflask.commands import spec_command @pytest.mark.parametrize('format', ['json', 'yaml', 'yml', 'foo']) def test_flask_spec_format(app, cli_runner, format, tmp_path): local_spec_path = tmp_path / 'openapi.json' @app.get('/') ...
stdout_result.output
assert
complex_expr
tests/test_commands.py
test_flask_spec_format
52
null
apiflask/apiflask
from marshmallow import fields from marshmallow import Schema from marshmallow import validate from apiflask.openapi_adapters import get_unique_schema_name from apiflask.openapi_adapters import OpenAPIHelper class TestOpenAPIHelper: def test_get_marshmallow_plugin_caching(self): """Test that marshmallow ...
plugin2
assert
variable
tests/test_openapi_adapters.py
test_get_marshmallow_plugin_caching
TestOpenAPIHelper
70
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from .schemas import Foo from .schemas import Query from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth @pytest.mark.parametrize('config_value', [True, False]) def test_auto_path_summary_with_methodview(app...
'Get Foo'
assert
string_literal
tests/test_settings_auto_behaviour.py
test_auto_path_summary_with_methodview
118
null
apiflask/apiflask
import json import pytest from .schemas import Foo from .schemas import Qux from apiflask.commands import spec_command def test_flask_spec_stdout(app, cli_runner): result = cli_runner.invoke(spec_command) assert 'openapi' in result.output assert json.loads(result.output) ==
app.spec
assert
complex_expr
tests/test_commands.py
test_flask_spec_stdout
13
null
apiflask/apiflask
import io import openapi_spec_validator as osv import pytest from flask.views import MethodView from packaging.version import Version from werkzeug.datastructures import FileStorage from .conftest import APISPEC_VERSION from .schemas import Bar from .schemas import EnumPathParameter from .schemas import Files from .s...
200
assert
numeric_literal
tests/test_decorator_input.py
test_input_with_query_location
90
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from flask.views import View from .schemas import Foo from apiflask import APIBlueprint from apiflask import HTTPTokenAuth @pytest.mark.parametrize('method', ['get', 'post', 'put', 'patch', 'delete']) def test_route_shortcuts(app, c...
method
assert
variable
tests/test_route.py
test_route_shortcuts
21
null
apiflask/apiflask
import pytest from apiflask.exceptions import abort from apiflask.exceptions import HTTPError @pytest.mark.parametrize( 'kwargs', [ {}, {'message': 'bad'}, {'message': 'bad', 'detail': {'location': 'json'}}, {'message': 'bad', 'detail': {'location': 'json'}, 'headers': {'X-FOO'...
'bar'
assert
string_literal
tests/test_exceptions.py
test_default_error_handler
99
null
apiflask/apiflask
import os import sys from importlib import metadata, reload import re import pytest from packaging.version import Version full_examples = [ 'basic', 'orm', 'cbv', 'openapi/basic', 'blueprint_tags', 'base_response/marshmallow', 'base_response/pydantic', 'pydantic', 'dataclass', ] e...
201
assert
numeric_literal
examples/test_examples.py
test_create_pet
95
null
apiflask/apiflask
import importlib import openapi_spec_validator as osv import pytest from apiflask import APIBlueprint def test_tags(app, client): assert app.tags is
None
assert
none_literal
tests/test_openapi_tags.py
test_tags
10
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_path_parameters_use_openapi_helper(app, client): """Test that path parameters are processed correctly.""" class PathSchema(Schema)...
1
assert
numeric_literal
tests/test_decoupling_integration.py
test_path_parameters_use_openapi_helper
302
null
apiflask/apiflask
from marshmallow import fields from marshmallow import Schema from marshmallow import validate from apiflask.openapi_adapters import get_unique_schema_name from apiflask.openapi_adapters import OpenAPIHelper class TestOpenAPIHelper: def test_schema_to_parameters_query(self): """Test schema_to_parameters ...
'age'
assert
string_literal
tests/test_openapi_adapters.py
test_schema_to_parameters_query
TestOpenAPIHelper
120
null
apiflask/apiflask
import pytest from apiflask import APIFlask def test_spec_path(app): assert app.spec_path app = APIFlask(__name__, spec_path=None) assert app.spec_path is
None
assert
none_literal
tests/test_openapi_blueprint.py
test_spec_path
23
null
apiflask/apiflask
import os import sys from importlib import metadata, reload import re import pytest from packaging.version import Version full_examples = [ 'basic', 'orm', 'cbv', 'openapi/basic', 'blueprint_tags', 'base_response/marshmallow', 'base_response/pydantic', 'pydantic', 'dataclass', ] e...
1
assert
numeric_literal
examples/test_examples.py
test_get_pets_pagination
181
null
apiflask/apiflask
import pytest from marshmallow import fields from marshmallow import Schema from marshmallow import ValidationError from apiflask.schema_adapters import registry from apiflask.schema_adapters.marshmallow import MarshmallowAdapter class TestMarshmallowAdapter: def test_serialize_output_many(self): """Test...
2
assert
numeric_literal
tests/test_schema_adapters.py
test_serialize_output_many
TestMarshmallowAdapter
209
null
apiflask/apiflask
import pytest from apiflask import APIFlask def test_spec_path(app): assert app.spec_path app = APIFlask(__name__, spec_path=None) assert app.spec_path is None assert 'openapi' in app.blueprints rules = list(app.url_map.iter_rules()) bp_endpoints = [rule.endpoint for rule in rules if rule.end...
2
assert
numeric_literal
tests/test_openapi_blueprint.py
test_spec_path
27
null
apiflask/apiflask
import pytest from apiflask.exceptions import abort from apiflask.exceptions import HTTPError def test_custom_error_classes(app, client): class PetDown(HTTPError): status_code = 400 message = 'The pet is down.' extra_data = {'error_code': '123', 'error_docs': 'https://example.com/docs/down...
'123'
assert
string_literal
tests/test_exceptions.py
test_custom_error_classes
133
null
apiflask/apiflask
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationModel from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 ...
1
assert
numeric_literal
tests/test_helpers.py
test_pagination_builder
49
null
apiflask/apiflask
import json import pytest from apiflask import APIFlask from apiflask.commands import spec_command def test_local_spec_path(app, cli_runner, tmp_path): local_spec_path = tmp_path / 'api.json' app.config['LOCAL_SPEC_PATH'] = local_spec_path result = cli_runner.invoke(spec_command) assert 'openapi' in...
app.spec
assert
complex_expr
tests/test_settings_openapi_spec.py
test_local_spec_path
61
null
apiflask/apiflask
import importlib import openapi_spec_validator as osv import pytest from apiflask import APIBlueprint def test_tags(app, client): assert app.tags is None app.tags = [ { 'name': 'foo', 'description': 'some description for foo', 'externalDocs': { 'des...
rv.json['tags']
assert
complex_expr
tests/test_openapi_tags.py
test_tags
27
null
apiflask/apiflask
import openapi_spec_validator as osv def test_overwrite_info(app, client): app.config['INFO'] = { 'description': 'Not set', 'termsOfService': 'Not set', 'contact': {'name': 'Not set', 'url': 'Not set', 'email': 'Not set'}, 'license': {'name': 'Not set', 'url': 'Not set'}, } ...
app.config['TERMS_OF_SERVICE']
assert
complex_expr
tests/test_settings_openapi_fields.py
test_overwrite_info
97
null
apiflask/apiflask
import json import openapi_spec_validator as osv import pytest from flask import request from .schemas import Bar from .schemas import Baz from .schemas import Foo from apiflask import APIBlueprint from apiflask import Schema from apiflask.commands import spec_command from apiflask.fields import Integer def test_ser...
None
assert
none_literal
tests/test_openapi_basic.py
test_servers_and_externaldocs
165
null
apiflask/apiflask
import pytest from apiflask import APIFlask def test_openapi_blueprint(app): assert 'openapi' in app.blueprints rules = list(app.url_map.iter_rules()) bp_endpoints = [rule.endpoint for rule in rules if rule.endpoint.startswith('openapi')] assert len(bp_endpoints) ==
3
assert
numeric_literal
tests/test_openapi_blueprint.py
test_openapi_blueprint
10
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from packaging.version import Version from .conftest import APISPEC_VERSION from .schemas import CustomHTTPError from .schemas import Foo def test_doc_responses(app, client): @app.route('/foo') @app.input(Foo) @app.outpu...
'bad'
assert
string_literal
tests/test_decorator_doc.py
test_doc_responses
185
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from .schemas import Foo from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_bare_view_base_response_spec(app, client): app.config['BASE_RESPONSE_SCHEMA'] = BaseResponse ...
{'type': 'integer'}
assert
collection
tests/test_base_response.py
test_bare_view_base_response_spec
169
null
apiflask/apiflask
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationModel from apiflask import PaginationSchema @pytest.mark.parametrize('code', [204, 400, 404, 456, 4123]) def test_get_reason_phrase(code): rv = get_reason_phrase(code) if code == 204: ...
'Not Found'
assert
string_literal
tests/test_helpers.py
test_get_reason_phrase
17
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask import Schema ...
404
assert
numeric_literal
tests/test_app.py
test_json_errors
30
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from .schemas import Foo from .schemas import HTTPError from .schemas import ValidationError from apiflask.schemas import EmptySchema from apiflask.schemas import http_error_schema from apiflask.security import HTTPBasicAuth def test_validation_error_status_code_and_...
'Bad'
assert
string_literal
tests/test_settings_response_customization.py
test_validation_error_status_code_and_description
65
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import APIFlask from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth @auth.error_processor def auth_error_processor(e): assert e.status_code == 401 assert e.message == 'Unauthorized' assert e.detail ...
{}
assert
collection
tests/test_security.py
auth_error_processor
66
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_headers_schema_uses_openapi_helper(app, client): """Test that response headers use openapi_helper.""" class HeaderSchema(Schema): ...
headers
assert
variable
tests/test_decoupling_integration.py
test_headers_schema_uses_openapi_helper
216
null
apiflask/apiflask
import openapi_spec_validator as osv from flask.views import MethodView from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_blueprint_enable_openapi(app, client): auth = HTTPBasicAuth() @app.get('/hello') @app.auth_required(au...
401
assert
numeric_literal
tests/test_blueprint.py
test_blueprint_enable_openapi
45
null
apiflask/apiflask
import pytest from apiflask.exceptions import abort from apiflask.exceptions import HTTPError @pytest.mark.parametrize( 'kwargs', [ {}, {'message': 'missing'}, {'message': 'missing', 'detail': {'location': 'query'}}, {'message': 'missing', 'detail': {'location': 'query'}, 'head...
404
assert
numeric_literal
tests/test_exceptions.py
test_abort
61
null
apiflask/apiflask
import pytest from marshmallow import fields from marshmallow import Schema from marshmallow import ValidationError from apiflask.schema_adapters import registry from apiflask.schema_adapters.marshmallow import MarshmallowAdapter class TestMarshmallowAdapter: def test_serialize_output(self): """Test seri...
'Max'
assert
string_literal
tests/test_schema_adapters.py
test_serialize_output
TestMarshmallowAdapter
197
null
apiflask/apiflask
import pytest from apiflask.exceptions import abort from apiflask.exceptions import HTTPError @pytest.mark.parametrize( 'kwargs', [ {}, {'message': 'bad'}, {'message': 'bad', 'detail': {'location': 'json'}}, {'message': 'bad', 'detail': {'location': 'json'}, 'headers': {'X-FOO'...
{}
assert
collection
tests/test_exceptions.py
test_httperror
42
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask import Schema ...
5
assert
numeric_literal
tests/test_app.py
test_view_function_arguments_order
113
null
apiflask/apiflask
import openapi_spec_validator as osv def test_overwrite_info(app, client): app.config['INFO'] = { 'description': 'Not set', 'termsOfService': 'Not set', 'contact': {'name': 'Not set', 'url': 'Not set', 'email': 'Not set'}, 'license': {'name': 'Not set', 'url': 'Not set'}, } ...
app.config['LICENSE']
assert
complex_expr
tests/test_settings_openapi_fields.py
test_overwrite_info
99
null
apiflask/apiflask
from marshmallow import fields from marshmallow import Schema from marshmallow import validate from apiflask.openapi_adapters import get_unique_schema_name from apiflask.openapi_adapters import OpenAPIHelper class TestOpenAPIHelper: def test_schema_to_json_schema_marshmallow(self): """Test schema_to_json...
'string'
assert
string_literal
tests/test_openapi_adapters.py
test_schema_to_json_schema_marshmallow
TestOpenAPIHelper
103
null
apiflask/apiflask
import sys import openapi_spec_validator as osv import pytest from apiflask import APIFlask pydantic = pytest.importorskip('pydantic') BaseModel = pydantic.BaseModel Field = pydantic.Field class TestPydanticIntegration: def test_query_parameters_with_pydantic(self): """Test query parameter validation w...
20
assert
numeric_literal
tests/test_pydantic_integration.py
test_query_parameters_with_pydantic
TestPydanticIntegration
264
null
apiflask/apiflask
import os import sys from importlib import metadata, reload import re import pytest from packaging.version import Version full_examples = [ 'basic', 'orm', 'cbv', 'openapi/basic', 'blueprint_tags', 'base_response/marshmallow', 'base_response/pydantic', 'pydantic', 'dataclass', ] e...
422
assert
numeric_literal
examples/test_examples.py
test_create_pet_with_bad_data
117
null
apiflask/apiflask
import openapi_spec_validator as osv from flask.views import MethodView from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_blueprint_object(): bp = APIBlueprint('test', __name__) assert bp.name ==
'test'
assert
string_literal
tests/test_blueprint.py
test_blueprint_object
11
null
apiflask/apiflask
from marshmallow import fields from marshmallow import Schema from marshmallow import validate from apiflask.openapi_adapters import get_unique_schema_name from apiflask.openapi_adapters import OpenAPIHelper class TestOpenAPIHelper: def test_schema_to_parameters_query(self): """Test schema_to_parameters ...
True
assert
bool_literal
tests/test_openapi_adapters.py
test_schema_to_parameters_query
TestOpenAPIHelper
117
null
apiflask/apiflask
import openapi_spec_validator as osv def test_overwrite_info(app, client): app.config['INFO'] = { 'description': 'Not set', 'termsOfService': 'Not set', 'contact': {'name': 'Not set', 'url': 'Not set', 'email': 'Not set'}, 'license': {'name': 'Not set', 'url': 'Not set'}, } ...
app.config['DESCRIPTION']
assert
complex_expr
tests/test_settings_openapi_fields.py
test_overwrite_info
96
null
apiflask/apiflask
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationModel from apiflask import PaginationSchema def test_pagination_builder_exception_case(app, client): class Pagination: page = 1 per_page = 20 pages = 100 tota...
500
assert
numeric_literal
tests/test_helpers.py
test_pagination_builder_exception_case
118
null
apiflask/apiflask
import pytest from apiflask.exceptions import abort from apiflask.exceptions import HTTPError @pytest.mark.parametrize( 'kwargs', [ {}, {'message': 'missing'}, {'message': 'missing', 'detail': {'location': 'query'}}, {'message': 'missing', 'detail': {'location': 'query'}, 'head...
'foo'
assert
string_literal
tests/test_exceptions.py
test_abort
71
null
apiflask/apiflask
import importlib import openapi_spec_validator as osv import pytest from apiflask import APIBlueprint def test_path_tags(app, client): bp = APIBlueprint('foo', __name__) @bp.get('/') def foo(): pass app.register_blueprint(bp) rv = client.get('/openapi.json') assert rv.status_code =...
['Foo']
assert
collection
tests/test_openapi_tags.py
test_path_tags
121
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from .schemas import Foo from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String @pytest.mark.parametrize( 'base_schema', [ BaseResponse, base_response_schema_dict, ...
str(e.value)
assert
func_call
tests/test_base_response.py
test_base_response_spec
84
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from packaging.version import Version from .conftest import APISPEC_VERSION from .schemas import CustomHTTPError from .schemas import Foo def test_doc_summary_and_description(app, client): @app.route('/foo') @app.doc(summary...
200
assert
numeric_literal
tests/test_decorator_doc.py
test_doc_summary_and_description
23
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from flask.views import View from .schemas import Foo from apiflask import APIBlueprint from apiflask import HTTPTokenAuth def test_route_on_method_view(app, client): @app.route('/') class Foo(MethodView): def get(se...
b'get'
assert
string_literal
tests/test_route.py
test_route_on_method_view
48
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import APIFlask def test_other_info_fields(app, client): assert app.description is
None
assert
none_literal
tests/test_openapi_info.py
test_other_info_fields
16
null
apiflask/apiflask
import openapi_spec_validator as osv from .schemas import Foo from .schemas import Header from .schemas import Pagination from .schemas import Query def test_path_arguments_order(app, client): @app.route('/<foo>/bar') @app.input(Query, location='query') @app.output(Foo) def path_and_query(foo, query_d...
'bar'
assert
string_literal
tests/test_openapi_paths.py
test_path_arguments_order
183
null
apiflask/apiflask
import json import openapi_spec_validator as osv import pytest from flask import request from .schemas import Bar from .schemas import Baz from .schemas import Foo from apiflask import APIBlueprint from apiflask import Schema from apiflask.commands import spec_command from apiflask.fields import Integer @app.spe...
'APIFlask'
assert
string_literal
tests/test_openapi_basic.py
edit_spec
26
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask import Schema ...
3
assert
numeric_literal
tests/test_app.py
test_view_function_arguments_order
109
null
apiflask/apiflask
import io from importlib.metadata import version import pytest from packaging.version import parse from werkzeug.datastructures import FileStorage from .schemas import Files from .schemas import FilesList from apiflask import Schema from apiflask.fields import Config @pytest.mark.skipif( parse(version('flask-mar...
{}
assert
collection
tests/test_fields.py
test_empty_file_field
71
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from .schemas import Foo from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_output_base_response(app, client): app.config['BASE_RESPONSE_SCHEMA'] = BaseResponse @app.g...
'test'
assert
string_literal
tests/test_base_response.py
test_output_base_response
58
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from apiflask import APIKeyCookieAuth from apiflask import APIKeyHeaderAuth from apiflask import APIKeyQueryAuth from apiflask import HTTPBasicAuth from apiflask import HTTPTokenAuth from apiflask.security import MultiAuth def test_multi_auth(app, client): basic_...
rv.json
assert
complex_expr
tests/test_openapi_security.py
test_multi_auth
254
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import APIFlask def test_info_title_and_version(app): assert app.title ==
'APIFlask'
assert
string_literal
tests/test_openapi_info.py
test_info_title_and_version
7
null
apiflask/apiflask
import pytest from apiflask import APIFlask def test_openapi_blueprint_url_prefix(app): assert app.openapi_blueprint_url_prefix is None prefix = '/api' app = APIFlask(__name__, openapi_blueprint_url_prefix=prefix) assert app.openapi_blueprint_url_prefix == prefix client = app.test_client() r...
404
assert
numeric_literal
tests/test_openapi_blueprint.py
test_openapi_blueprint_url_prefix
149
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from .schemas import Foo from .schemas import Query from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth @pytest.mark.parametrize('config_value', [True, False]) def test_auto_operationid(app, client, config_...
'get_foo'
assert
string_literal
tests/test_settings_auto_behaviour.py
test_auto_operationid
387
null
apiflask/apiflask
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationModel from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 ...
200
assert
numeric_literal
tests/test_helpers.py
test_pagination_builder
48
null
apiflask/apiflask
import openapi_spec_validator as osv def test_info(app, client): app.config['INFO'] = { 'description': 'My API', 'termsOfService': 'http://example.com', 'contact': { 'name': 'API Support', 'url': 'http://www.example.com/support', 'email': 'support@example...
app.config['INFO']['license']
assert
complex_expr
tests/test_settings_openapi_fields.py
test_info
70
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from .schemas import Foo from .schemas import Query from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth def test_auto_tags(app, client): bp = APIBlueprint('foo', __name__) app.config['AUTO_TAGS'] = ...
[]
assert
collection
tests/test_settings_auto_behaviour.py
test_auto_tags
23
null
apiflask/apiflask
import openapi_spec_validator as osv from apiflask import Schema from apiflask.fields import Field from apiflask.fields import Integer from apiflask.fields import String def test_schema_name_resolver_with_adapter(app, client): """Test that schema name resolver uses adapter.""" @app.post('/pets') @app.inp...
200
assert
numeric_literal
tests/test_decoupling_integration.py
test_schema_name_resolver_with_adapter
42
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from flask.views import MethodView from packaging.version import Version from .conftest import APISPEC_VERSION from .schemas import CustomHTTPError from .schemas import Foo def test_doc_responses_custom_spec(app, client): response_spec = { 'description': ...
False
assert
bool_literal
tests/test_decorator_doc.py
test_doc_responses_custom_spec
277
null
apiflask/apiflask
import openapi_spec_validator as osv from .schemas import Foo from .schemas import Header from .schemas import Pagination from .schemas import Query def test_parameters_registration(app, client): @app.route('/foo') @app.input(Query, location='query') @app.output(Foo) def foo(query_data): pass ...
10
assert
numeric_literal
tests/test_openapi_paths.py
test_parameters_registration
212
null
apiflask/apiflask
import json import openapi_spec_validator as osv import pytest from flask import request from .schemas import Bar from .schemas import Baz from .schemas import Foo from apiflask import APIBlueprint from apiflask import Schema from apiflask.commands import spec_command from apiflask.fields import Integer def test_spe...
app.spec
assert
complex_expr
tests/test_openapi_basic.py
test_spec
18
null
apiflask/apiflask
import openapi_spec_validator as osv import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask import Schema ...
405
assert
numeric_literal
tests/test_app.py
test_json_errors_reuse_werkzeug_headers
59
null