repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_transform_skipping
assert
collection
45
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
[1, 2, 3]
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_iso8601_format
assert
collection
48
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"foo": None}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_optional_iso8601_format
assert
collection
42
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"bar": None}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_pydantic_mismatched_types
assert
collection
45
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"foo": True}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_datetime_with_alias
assert
collection
39
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"prop": None}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_pydantic_model_to_dictionary
assert
collection
39
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"foo": "hi!"}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_iterable_union_str
assert
collection
39
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"FOO": "bar"}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_base64_file_input
assert
collection
40
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"foo": "bar"}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_transform.py
test_ignores_invalid_input
assert
collection
39
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import NOT_GIVEN, Base64FileInput from anthropi...
{"bAr": "<foo>"}
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_utils/test_proxy.py
test_recursive_proxy
assert
collection
12
import operator from typing import Any from typing_extensions import override from anthropic._utils import LazyProxy def test_recursive_proxy() -> None: proxy = RecursiveLazyProxy() assert repr(proxy) == "RecursiveLazyProxy" assert str(proxy) == "RecursiveLazyProxy" assert dir(proxy) ==
[]
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_utils/test_proxy.py
test_recursive_proxy
assert
string_literal
10
import operator from typing import Any from typing_extensions import override from anthropic._utils import LazyProxy def test_recursive_proxy() -> None: proxy = RecursiveLazyProxy() assert repr(proxy) ==
"RecursiveLazyProxy"
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_utils/test_typing.py
test_extract_type_var
assert
variable
13
from __future__ import annotations from typing import Generic, TypeVar, cast from anthropic._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") def test_extract_type_var() -> None: assert
int
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_utils/test_typing.py
test_extract_type_var_multiple
assert
variable
17
from __future__ import annotations from typing import Generic, TypeVar, cast from anthropic._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") def test_extract_type_var_multiple() -> None: typ = BaseGenericMultipleTypeArgs[int, str, None] generic_bases = c...
str
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/test_utils/test_typing.py
test_extract_type_var_multiple
assert
func_call
18
from __future__ import annotations from typing import Generic, TypeVar, cast from anthropic._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") def test_extract_type_var_multiple() -> None: typ = BaseGenericMultipleTypeArgs[int, str, None] generic_bases = c...
type(None)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_type
assert
none_literal
64
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
None
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_type
assert_*
variable
99
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
key)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_type
assert_*
variable
100
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
item)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_type
assert_*
variable
119
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
value)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
_assert_list_type
assert_*
variable
139
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
entry)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_model
assert_*
variable
37
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
field_value)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
anthropics/anthropic-sdk-python
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
train
train
tests/utils.py
assert_matches_type
assert
func_call
90
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthropic._utils ...
get_args(type_)
46e4b98bac8f3f4ae419aa6e9054a30436bad5d1
159
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_get_pets
assert
numeric_literal
43
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
3
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_get_pets_pagination
assert
numeric_literal
43
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
5
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_get_pets_pagination
assert
numeric_literal
45
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_view_function_arguments_order
assert
numeric_literal
47
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_view_function_arguments_order
assert
numeric_literal
48
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
3
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_view_function_arguments_order
assert
numeric_literal
52
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
5
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_dispatch_static_request
assert
numeric_literal
31
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
2
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_async.py
test_output_on_async_view
assert
numeric_literal
16
from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import HTTPTokenAuth def test_output_on_async_view(app, client): @app.get('/foo') @app.output(Foo) async def foo(): return {'id': 1, 'name': 'foo'} rv = client.get('/foo') assert rv.status_code == 200...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_input.py
test_input_with_path_location
assert
numeric_literal
27
import io import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec from werkzeug.datastructures import FileStorage from .schemas import Bar from .schemas import EnumPathParameter from .schemas import Files from .schemas import Foo from .schemas import Form from .schemas import...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_output.py
test_response_content_type
assert
numeric_literal
28
from dataclasses import dataclass from flask import make_response from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Query from apiflask import Schema from apiflask.fields import Field from apiflask.fields import String def test_response_...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_helpers.py
test_pagination_builder
assert
numeric_literal
27
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 next_num = 2 has_next = Tru...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_basic.py
test_spec_schemas
assert
numeric_literal
49
import json import pytest from flask import request from openapi_spec_validator import validate_spec 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 ...
5
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_openapi_blueprint
assert
numeric_literal
10
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
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_spec_path
assert
numeric_literal
14
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
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_docs_path
assert
numeric_literal
14
import pytest from apiflask import APIFlask def test_docs_path(app): assert app.docs_path app = APIFlask(__name__, docs_path=None) assert app.docs_path is None rules = list(app.url_map.iter_rules()) bp_endpoints = [rule.endpoint for rule in rules if rule.endpoint.startswith('openapi')] asse...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_disable_openapi_with_enable_openapi_arg
assert
numeric_literal
14
import pytest from apiflask import APIFlask def test_disable_openapi_with_enable_openapi_arg(app): assert app.enable_openapi app = APIFlask(__name__, enable_openapi=False) assert app.enable_openapi is False rules = list(app.url_map.iter_rules()) bp_endpoints = [rule.endpoint for rule in rules if...
0
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_paths.py
test_parameters_registration
assert
numeric_literal
34
from openapi_spec_validator import validate_spec 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): ...
1
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_paths.py
test_parameters_registration
assert
numeric_literal
35
from openapi_spec_validator import validate_spec 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): ...
4
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_openapi_fields.py
test_security_shemes
assert
numeric_literal
20
from openapi_spec_validator import validate_spec def test_security_shemes(app, client): app.config['SECURITY_SCHEMES'] = { 'ApiKeyAuth': { 'type': 'apiKey', 'in': 'header', 'name': 'X-API-Key' }, 'BasicAuth': { 'type': 'http', 'sch...
2
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_get_pets_pagination
assert
numeric_literal
41
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
20
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_helpers.py
test_pagination_builder
assert
numeric_literal
33
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 next_num = 2 has_next = Tru...
20
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_paths.py
test_parameters_registration
assert
numeric_literal
40
from openapi_spec_validator import validate_spec 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): ...
10
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_say_hello
assert
numeric_literal
37
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_get_pet
assert
numeric_literal
54
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
404
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_create_pet
assert
numeric_literal
40
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
201
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_create_pet_with_bad_data
assert
numeric_literal
43
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
422
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
examples/test_examples.py
test_delete_pet
assert
numeric_literal
37
import os import sys from importlib import reload import pytest full_examples = [ 'basic', 'orm', 'cbv', 'openapi', 'blueprint_tags', 'base_response', 'dataclass', ] examples = full_examples + [ 'pagination' ] def client(request): app_path = os.path.join(os.path.dirname(__file__)...
204
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_json_errors
assert
numeric_literal
21
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
404
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_json_errors_reuse_werkzeug_headers
assert
numeric_literal
30
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
405
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_error_callback
assert
numeric_literal
32
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_async.py
test_async_view
assert
numeric_literal
14
from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import HTTPTokenAuth def test_async_view(app, client): @app.get('/') async def index(): return {'message': 'hello'} rv = client.get('/') assert rv.status_code ==
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_async.py
test_async_error_processor
assert
numeric_literal
14
from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import HTTPTokenAuth def test_async_error_processor(app, client): @app.error_processor async def custom_error_processor(e): return {'foo': 'test'}, e.status_code, e.headers rv = client.get('/foo') assert...
404
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_async.py
test_auth_required_on_async_view
assert
numeric_literal
16
from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import HTTPTokenAuth def test_auth_required_on_async_view(app, client): auth = HTTPTokenAuth() @app.get('/') @app.auth_required(auth) async def index(): pass rv = client.get('/') assert rv.status...
401
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_base_response.py
test_output_base_response
assert
numeric_literal
21
import pytest from openapi_spec_validator import validate_spec 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...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_base_response.py
test_output_base_response
assert
numeric_literal
26
import pytest from openapi_spec_validator import validate_spec 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...
123
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_blueprint.py
test_blueprint_enable_openapi
assert
numeric_literal
32
from flask.views import MethodView from openapi_spec_validator import validate_spec 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...
401
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_blueprint.py
test_blueprint_enable_openapi
assert
numeric_literal
34
from flask.views import MethodView from openapi_spec_validator import validate_spec 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...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_auth_required.py
test_auth_required
assert
numeric_literal
45
from flask.views import MethodView from openapi_spec_validator import validate_spec from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_auth_required(app, client): auth = HTTPBasicAuth() @auth.verify_password def verify_passwo...
401
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_auth_required.py
test_auth_required
assert
numeric_literal
48
from flask.views import MethodView from openapi_spec_validator import validate_spec from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_auth_required(app, client): auth = HTTPBasicAuth() @auth.verify_password def verify_passwo...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_auth_required.py
test_auth_required
assert
numeric_literal
52
from flask.views import MethodView from openapi_spec_validator import validate_spec from apiflask import APIBlueprint from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_auth_required(app, client): auth = HTTPBasicAuth() @auth.verify_password def verify_passwo...
403
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_doc.py
test_doc_summary_and_description
assert
numeric_literal
21
import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import CustomHTTPError from .schemas import Foo def test_doc_summary_and_description(app, client): @app.route('/foo') @app.doc(summary='summary from doc decorator') def foo(): pass ...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_input.py
test_input_with_query_location
assert
numeric_literal
25
import io import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec from werkzeug.datastructures import FileStorage from .schemas import Bar from .schemas import EnumPathParameter from .schemas import Files from .schemas import Foo from .schemas import Form from .schemas import...
422
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_input.py
test_input_with_query_location
assert
numeric_literal
43
import io import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec from werkzeug.datastructures import FileStorage from .schemas import Bar from .schemas import EnumPathParameter from .schemas import Files from .schemas import Foo from .schemas import Form from .schemas import...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_output.py
test_output
assert
numeric_literal
38
from dataclasses import dataclass from flask import make_response from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Query from apiflask import Schema from apiflask.fields import Field from apiflask.fields import String def test_output(ap...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_output.py
test_output
assert
numeric_literal
42
from dataclasses import dataclass from flask import make_response from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Query from apiflask import Schema from apiflask.fields import Field from apiflask.fields import String def test_output(ap...
201
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_output.py
test_output
assert
numeric_literal
46
from dataclasses import dataclass from flask import make_response from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Query from apiflask import Schema from apiflask.fields import Field from apiflask.fields import String def test_output(ap...
202
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_output.py
test_output_with_empty_dict_as_schema
assert
numeric_literal
33
from dataclasses import dataclass from flask import make_response from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Query from apiflask import Schema from apiflask.fields import Field from apiflask.fields import String def test_output_wi...
204
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_exceptions.py
test_httperror
assert
numeric_literal
23
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'}} ]) def test_htt...
400
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_exceptions.py
test_httperror
assert
numeric_literal
37
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'}} ]) def test_htt...
500
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_exceptions.py
test_abort
assert
numeric_literal
20
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'}, 'headers': {'X-BAR': 'foo'}}, ...
404
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_exceptions.py
test_abort
assert
numeric_literal
32
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'}, 'headers': {'X-BAR': 'foo'}}, ...
123
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_fields.py
test_file_field
assert
numeric_literal
19
import io from werkzeug.datastructures import FileStorage from .schemas import Files from .schemas import FilesList def test_file_field(app, client): @app.post('/') @app.input(Files, location='files') def index(files_data): data = {} if 'image' in files_data and isinstance(files_data['ima...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_fields.py
test_file_field
assert
numeric_literal
41
import io from werkzeug.datastructures import FileStorage from .schemas import Files from .schemas import FilesList def test_file_field(app, client): @app.post('/') @app.input(Files, location='files') def index(files_data): data = {} if 'image' in files_data and isinstance(files_data['ima...
422
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_helpers.py
test_pagination_builder
assert
numeric_literal
26
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 next_num = 2 has_next = Tru...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_helpers.py
test_pagination_builder
assert
numeric_literal
34
import pytest from apiflask import get_reason_phrase from apiflask import pagination_builder from apiflask import PaginationSchema def test_pagination_builder(app, client): class Pagination: page = 1 per_page = 20 pages = 100 total = 2000 next_num = 2 has_next = Tru...
100
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_basic.py
test_spec_processor
assert
numeric_literal
27
import json import pytest from flask import request from openapi_spec_validator import validate_spec 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 ...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_yaml_spec
assert
numeric_literal
13
import pytest from apiflask import APIFlask @pytest.mark.parametrize('spec_path', ['/spec.yaml', '/spec.yml']) def test_yaml_spec(spec_path): app = APIFlask(__name__, spec_path=spec_path) app.config['SPEC_FORMAT'] = 'yaml' client = app.test_client() rv = client.get(spec_path) assert rv.status_co...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_blueprint.py
test_openapi_blueprint_url_prefix
assert
numeric_literal
15
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
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_info.py
test_other_info_fields
assert
numeric_literal
25
from openapi_spec_validator import validate_spec from apiflask import APIFlask def test_other_info_fields(app, client): assert app.description is None assert app.terms_of_service is None assert app.contact is None assert app.license is None app.description = 'My API' app.terms_of_service = 'h...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_paths.py
test_spec_path_summary_description_from_docs
assert
numeric_literal
26
from openapi_spec_validator import validate_spec from .schemas import Foo from .schemas import Header from .schemas import Pagination from .schemas import Query def test_spec_path_summary_description_from_docs(app, client): @app.route('/users') @app.output(Foo) def get_users(): """Get Users""" ...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_security.py
test_httpbasicauth_security_scheme
assert
numeric_literal
17
import pytest from openapi_spec_validator import validate_spec from apiflask import HTTPBasicAuth from apiflask import HTTPTokenAuth def test_httpbasicauth_security_scheme(app, client): auth = HTTPBasicAuth() @app.get('/') @app.auth_required(auth) def foo(): pass rv = client.get('/openap...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_tags.py
test_tags
assert
numeric_literal
22
import pytest from openapi_spec_validator import validate_spec from apiflask import APIBlueprint def test_tags(app, client): assert app.tags is None app.tags = [ { 'name': 'foo', 'description': 'some description for foo', 'externalDocs': { 'descripti...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_route.py
test_route_shortcuts
assert
numeric_literal
24
import pytest from flask.views import MethodView from flask.views import View from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import APIBlueprint from apiflask import HTTPTokenAuth @pytest.mark.parametrize('method', ['get', 'post', 'put', 'patch', 'delete']) def test_route_shor...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_route.py
test_class_attribute_decorators
assert
numeric_literal
25
import pytest from flask.views import MethodView from flask.views import View from openapi_spec_validator import validate_spec from .schemas import Foo from apiflask import APIBlueprint from apiflask import HTTPTokenAuth def test_class_attribute_decorators(app, client): auth = HTTPTokenAuth() @app.route('/')...
401
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_schemas.py
test_file_schema
assert
numeric_literal
19
import pytest from openapi_spec_validator import validate_spec from apiflask.schemas import EmptySchema from apiflask.schemas import FileSchema def test_file_schema(app, client): @app.get('/image') @app.output( FileSchema(type='string', format='binary'), content_type='image/png', descr...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_security.py
test_default_auth_error_handler
assert
numeric_literal
17
from openapi_spec_validator import validate_spec from apiflask import APIFlask from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_default_auth_error_handler(app, client): auth = HTTPTokenAuth() @app.route('/foo') @app.auth_required(auth) def foo(): ...
401
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_security.py
test_current_user_as_property
assert
numeric_literal
22
from openapi_spec_validator import validate_spec from apiflask import APIFlask from apiflask.security import HTTPBasicAuth from apiflask.security import HTTPTokenAuth def test_current_user_as_property(app, client): auth = HTTPBasicAuth() @auth.verify_password def verify_password(username, password): ...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_api_docs.py
test_docs_favicon
assert
numeric_literal
10
import pytest from apiflask import APIFlask def test_docs_favicon(app, client): app.config['DOCS_FAVICON'] = '/my-favicon.png' rv = client.get('/docs') assert rv.status_code ==
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_auto_behaviour.py
test_auto_tags
assert
numeric_literal
21
import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec 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['AU...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_openapi_fields.py
test_openapi_fields
assert
numeric_literal
52
from openapi_spec_validator import validate_spec 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 mor...
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_openapi_spec.py
test_json_spec_mimetype
assert
numeric_literal
11
import json import pytest from apiflask import APIFlask from apiflask.commands import spec_command def test_json_spec_mimetype(app, client): rv = client.get('/openapi.json') assert rv.status_code ==
200
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_app.py
test_json_errors
assert
collection
26
import pytest from apispec import BasePlugin from flask import Blueprint from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import Bar from .schemas import Foo from .schemas import Pagination from apiflask import APIBlueprint from apiflask import APIFlask from apiflask im...
{}
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_blueprint.py
test_blueprint_enable_openapi
assert
collection
36
from flask.views import MethodView from openapi_spec_validator import validate_spec 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...
[]
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_exceptions.py
test_httperror
assert
collection
39
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'}} ]) def test_htt...
{}
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_schemas.py
test_empty_schema
assert
collection
26
import pytest from openapi_spec_validator import validate_spec from apiflask.schemas import EmptySchema from apiflask.schemas import FileSchema @pytest.mark.parametrize('schema', [{}, EmptySchema]) def test_empty_schema(app, client, schema): @app.route('/foo') @app.output(schema, status_code=204) def empt...
{}
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_security.py
auth_error_processor
assert
collection
12
from openapi_spec_validator import validate_spec 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' asse...
{}
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_settings_auto_behaviour.py
test_auto_tags
assert
collection
23
import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec 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['AU...
[]
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_decorator_doc.py
test_doc_tags
assert
collection
25
import pytest from flask.views import MethodView from openapi_spec_validator import validate_spec from .schemas import CustomHTTPError from .schemas import Foo def test_doc_tags(app, client): app.tags = ['foo', 'bar'] @app.route('/foo') @app.doc(tags=['foo']) def foo(): pass @app.route('...
['foo']
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor
apiflask/apiflask
d4070ebed440918b8e2389601ab2417958129cee
138
train
train
tests/test_openapi_tags.py
test_path_tags
assert
collection
19
import pytest from openapi_spec_validator import validate_spec 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 == 200 ...
['Foo']
d4070ebed440918b8e2389601ab2417958129cee
138
v2_extractor_at_anchor