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 |
|---|---|---|---|---|---|---|---|---|---|
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_nesting_with_class_name_many():
c_obj = C(1, bs=[B(2), B(3), B(4)])
c_serialized = CSchema().dump(c_obj)
assert len(c_serialized["bs"]) == | len(c_obj.bs) | assert | func_call | tests/test_registry.py | test_nesting_with_class_name_many | 172 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
missing,
)
from marshmallow.exceptions import StringNotCollectionError
from marshmallow.orderedset import OrderedSet
from tests.base import ALL_FIELDS
class TestParentAndName:
def schema(... | "foo" | assert | string_literal | tests/test_fields.py | test_simple_field_parent_and_name | TestParentAndName | 107 | null |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_merging_custom_error_and_dict(self):
asser | merge_errors(CustomError(123, "error1"), {"field1": "error2"}) | assert | func_call | tests/test_error_store.py | test_merging_custom_error_and_dict | TestMergeErrors | 84 | null |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | t2.microsecond | assert | complex_expr | tests/base.py | assert_time_equal | 76 | null | |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | d2.year | assert | complex_expr | tests/base.py | assert_date_equal | 67 | null | |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_merging_none_and_dict(self):
assert merge_errors(None, {"field1": "error1"}) == | {"field1": "error1"} | assert | collection | tests/test_error_store.py | test_merging_none_and_dict | TestMergeErrors | 29 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_serializer_class_registry_register_same_classname_different_module():
reglen = len(class_registry._registry)
type("MyTestRegSchema", (Schema,), {"__module__": "modA"})
assert "M... | reglen + 2 | assert | complex_expr | tests/test_registry.py | test_serializer_class_registry_register_same_classname_different_module | 65 | null | |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_length_min():
assert validate.Length(3, 5)("foo") == "foo"
assert validate.Length(3, 5)([1, 2, 3]) == [1, 2, 3]
assert validate.Length(0)("a") == "a"
assert validate.Length(0)([1]) == [1]
assert validate.Length()(... | "" | assert | string_literal | tests/test_validate.py | test_length_min | 429 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_from_dict():
d = dict(items=["foo", "bar"], keys=["baz", "quux"])
assert utils.get_value(d, "items") == ["foo"... | ["baz", "quux"] | assert | collection | tests/test_utils.py | test_get_value_from_dict | 69 | null | |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | ["Fail"] | assert | collection | tests/test_context.py | test_validates_schema_with_context | TestContext | 251 | null |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | "FOOBAR" | assert | string_literal | tests/test_context.py | test_function_field_deserialization_with_context | TestContext | 188 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validate,
validates,
validates_schema,
)
from tests.base import predicate
def test_decorator_error_handling():
class Examp... | 2 | assert | numeric_literal | tests/test_decorators.py | test_decorator_error_handling | 775 | null | |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | t2.hour | assert | complex_expr | tests/base.py | assert_time_equal | 73 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_serializer_class_registry_register_same_classname_different_module():
reglen = len(class_registry._registry)
type("MyTestRegSchema", (Schema,), {"__module__": "modA"})
assert "M... | reglen + 2 + 1 | assert | complex_expr | tests/test_registry.py | test_serializer_class_registry_register_same_classname_different_module | 76 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
missing,
)
from marshmallow.exceptions import StringNotCollectionError
from marshmallow.orderedset import OrderedSet
from tests.base import ALL_FIELDS
class TestParentAndName:
def schema(... | schema | assert | variable | tests/test_fields.py | test_simple_field_parent_and_name | TestParentAndName | 106 | null |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestFieldOrdering:
def test_declared_field_order_is_maintained_on_dump(self, user):
ser = UserSchema()
data = ser.dump(user)
keys = list(data)
assert keys == | [ "name", "email", "age", "created", "id", "homepage", "birthdate", ] | assert | collection | tests/test_options.py | test_declared_field_order_is_maintained_on_dump | TestFieldOrdering | 25 | null |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_length_min():
assert validate.Length(3, 5)("foo") == "foo"
assert validate.Length(3, 5)([1, 2, 3]) == [1, 2, 3]
assert validate.Length(0)("a") == "a"
assert validate.Length(0)([1]) == [1]
assert validate.Length()("... | [] | assert | collection | tests/test_validate.py | test_length_min | 430 | null | |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import math
import uuid
from unittest.mock import patch
import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
fields,
missing,
validate,
)
from marshmallow.exceptions import ValidationError
from tests.base import (
... | 3 | assert | numeric_literal | tests/test_deserialization.py | test_partial_deserialization | TestSchemaDeserialization | 1,911 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | "" | assert | string_literal | tests/test_serialization.py | test_string_field_default_to_empty_string | TestFieldSerialization | 626 | null |
marshmallow-code/marshmallow | import datetime as dt
import math
import random
from collections import OrderedDict
from typing import NamedTuple, cast
import pytest
import simplejson as json
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
class_registry,
fields,
validate,
validates,
validates_schema,
... | 2 | assert | numeric_literal | tests/test_schema.py | test_dump_many | 159 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validate,
validates,
validates_schema,
)
from tests.base import predicate
class TestPassOriginal:
def test_pass_original_s... | 42 | assert | numeric_literal | tests/test_decorators.py | test_pass_original_single | TestPassOriginal | 152 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
missing,
)
from marshmallow.exceptions import StringNotCollectionError
from marshmallow.orderedset import OrderedSet
from tests.base import ALL_FIELDS
class MyField(fields.Field[str]):... | 42 | assert | numeric_literal | tests/test_fields.py | _deserialize | MyField | 58 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow.exceptions import ValidationError
class TestValidationError:
def test_can_store_field_name(self):
err = ValidationError("invalid email", field_name="email")
assert err.field_name == | "email" | assert | string_literal | tests/test_exceptions.py | test_can_store_field_name | TestValidationError | 22 | null |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_noneof():
assert validate.NoneOf([1, 2, 3])(4) == | 4 | assert | numeric_literal | tests/test_validate.py | test_noneof | 661 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_nesting_with_class_name_many():
c_obj = C(1, bs=[B(2), B(3), B(4)])
c_serialized = CSchema().dump(c_obj)
assert len(c_serialized["bs"]) == len(c_obj.bs)
assert c_serialized... | c_obj.bs[0].id | assert | complex_expr | tests/test_registry.py | test_nesting_with_class_name_many | 173 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_for_nested_object():
tri = Triangle(p1=PointClass(1, 2), p2=PointNT(3, 4), p3={"x": 5, "y": 6})
assert utils.g... | 5 | assert | numeric_literal | tests/test_utils.py | test_get_value_for_nested_object | 62 | null | |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | d2.day | assert | complex_expr | tests/base.py | assert_date_equal | 69 | null | |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | 1 | assert | numeric_literal | tests/test_serialization.py | test_enum_field_by_value_true_serialization | TestFieldSerialization | 242 | null |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestIncludeOption:
def test_added_fields_are_inherited(self):
class AddFieldsChild(self.AddFieldsSchema): # type: ignore[name-defined]
email = fields.Str()
s = AddFieldsChild()
assert "email" in | s._declared_fields | assert | complex_expr | tests/test_options.py | test_added_fields_are_inherited | TestIncludeOption | 147 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_serializer_class_registry_register_same_classname_different_module():
reglen = len(class_registry._registry)
type("MyTestRegSchema", (Schema,), {"__module__": "modA"})
assert "M... | 2 | assert | numeric_literal | tests/test_registry.py | test_serializer_class_registry_register_same_classname_different_module | 73 | null | |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_range_max():
assert validate.Range(1, 2)(2) == | 2 | assert | numeric_literal | tests/test_validate.py | test_range_max | 373 | null | |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | { "f_1": 1, "f_2": 3, "f_3": 1, "f_4": 5, } | assert | collection | tests/test_context.py | test_decorated_processors_with_context | TestContext | 228 | null |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_merging_dict_and_custom_error(self):
asser | merge_errors({"field1": "error1"}, CustomError(123, "error2")) | assert | func_call | tests/test_error_store.py | test_merging_dict_and_custom_error | TestMergeErrors | 127 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_serializer_class_registry_register_same_classname_different_module():
reglen = len(class_registry._registry)
type("MyTestRegSchema", (Schema,), {"__module__": "modA"})
assert "M... | 1 | assert | numeric_literal | tests/test_registry.py | test_serializer_class_registry_register_same_classname_different_module | 62 | null | |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_dict_not_changed(self):
store = ErrorStore()
message = {"foo": ["bar"]}
store.store_error(message)
store.store_error(message)
... | {"foo": ["bar"]} | assert | collection | tests/test_error_store.py | test_dict_not_changed | TestMergeErrors | 166 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validate,
validates,
validates_schema,
)
from tests.base import predicate
@pytest.mark.parametrize("unknown", (EXCLUDE, INCLUD... | {} | assert | collection | tests/test_decorators.py | test_decorated_processor_returning_none | 126 | null | |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | 0 | assert | numeric_literal | tests/test_serialization.py | test_integer_field_default | TestFieldSerialization | 111 | null |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | t2.second | assert | complex_expr | tests/base.py | assert_time_equal | 75 | null | |
marshmallow-code/marshmallow | import datetime as dt
import math
import random
from collections import OrderedDict
from typing import NamedTuple, cast
import pytest
import simplejson as json
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
class_registry,
fields,
validate,
validates,
validates_schema,
... | 1 | assert | numeric_literal | tests/test_schema.py | test_load_resets_errors | 66 | null | |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_deep_merging_dicts(self):
asser | {"field1": {"field2": ["error1", "error2"]}} | assert | collection | tests/test_error_store.py | test_deep_merging_dicts | TestMergeErrors | 149 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | -1 | assert | numeric_literal | tests/test_serialization.py | test_timedelta_field | TestFieldSerialization | 712 | null |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | d2.month | assert | complex_expr | tests/base.py | assert_date_equal | 68 | null | |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_predicate():
class Dummy:
def _true(self):
return True
def _false(self):
return False
def _list(self):
return [1, 2, 3]
def _empty(self):
return []... | d | assert | variable | tests/test_validate.py | test_predicate | 616 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
@pytest.mark.parametrize(
"obj", [PointNT(24, 42), PointClass(24, 42), PointDict(24, 42), {"x": 24, "y": 42}]
)
def test_get_value_fr... | 42 | assert | numeric_literal | tests/test_utils.py | test_get_value_from_object | 39 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_from_dict():
d = dict(items=["foo", "bar"], keys=["baz", "quux"])
assert utils.get_value(d, "items") == | ["foo", "bar"] | assert | collection | tests/test_utils.py | test_get_value_from_dict | 68 | null | |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | ValidationError) | pytest.raises | variable | tests/test_context.py | test_validates_schema_with_context | TestContext | 249 | null |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | {"ctx_fld": 2} | assert | collection | tests/test_context.py | test_context_load_dump | TestContext | 52 | null |
marshmallow-code/marshmallow | import datetime as dt
import math
import random
from collections import OrderedDict
from typing import NamedTuple, cast
import pytest
import simplejson as json
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
class_registry,
fields,
validate,
validates,
validates_schema,
... | s | assert | variable | tests/test_schema.py | test_exclude_in_init | 586 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow.exceptions import ValidationError
class TestValidationError:
def test_stores_message_in_list(self):
err = ValidationError("foo")
assert err.messages == | ["foo"] | assert | collection | tests/test_exceptions.py | test_stores_message_in_list | TestValidationError | 9 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_enum_duplicate_values(self):
# This one currently causes a full generator failure rather than a warning
re... | str(result.exception) | assert | func_call | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_enum_duplicate_values | TestEnumAndConstInvalidSchemas | 66 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | expected_type_hint | assert | variable | end_to_end_tests/functional_tests/helpers.py | assert_model_property_type_hint | 76 | null | |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraysWithPrefixItems:
def test_type_hints(self, ModelWithSinglePrefixItem, ModelWithPrefixItems, ModelWithMi... | "list[SimpleObject | str] | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_type_hints | TestArraysWithPrefixItems | 130 | null |
openapi-generators/openapi-python-client | import pytest
from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestInvalidDefaultValues:
@pytest.mark.parametrize(
("model_name", "message"),
[
("WithBadBoolean", "Invalid boolean value"),
("WithBadIntAsString", "... | message) | assert_* | variable | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_defaults.py | test_bad_default_warning | TestInvalidDefaultValues | 88 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestEndpointDocstrings:
def test_response_single_type(self, get_simple_thing_sync):
assert DocstringParser(get_simple_thing_sync).get_section("Returns... | [ "GoodResponse", ] | assert | collection | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_response_single_type | TestEndpointDocstrings | 142 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | warnings.by_schema[schema_name] | assert | complex_expr | end_to_end_tests/functional_tests/helpers.py | assert_bad_schema | 109 | null | |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_type_hints(self, ModelWithUnion, ModelWithRequiredUnion, ModelWithUnionOfOne, ThingA):
... | "ThingA | ThingB") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_type_hints | TestOneOf | 136 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_enum_bad_default_value(self, generated_client):
assert_bad_schema(generated_client, "WithBadDefaultValue", | "Value B is not valid") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_enum_bad_default_value | TestEnumAndConstInvalidSchemas | 39 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraySchemas:
def test_array_of_int(self, ModelWithArrayOfInts):
asse | ModelWithArrayOfInts(array_prop=[1, 2])) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_array_of_int | TestArraySchemas | 48 | null |
openapi-generators/openapi-python-client | import pytest
from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestArrayInvalidSchemas:
def test_invalid_items_ref(self, generated_client):
assert_bad_schema(generated_client, "ArrayWithInvalidItemsRef", | "invalid data in items of array") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_arrays.py | test_invalid_items_ref | TestArrayInvalidSchemas | 23 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestEndpointDocstrings:
def test_params(self, get_attribute_by_index_sync):
assert DocstringParser(get_attribute_by_index_sync).get_section("Args:") =... | [ "id (str): Which one.", "index (int):", "fries (bool | Unset): Do you want fries with that?", ] | assert | collection | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_params | TestEndpointDocstrings | 159 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
from end_to_end_tests.functional_tests.helpers import (
with_generated_client_fixture,
with_generated_code_imports,
)
class TestEnumDefaults:
def test_enum_default(self, MyEnum, MyModel):
assert MyModel().enum_prop == | MyEnum.A | assert | complex_expr | end_to_end_tests/functional_tests/generated_code_execution/test_defaults.py | test_enum_default | TestEnumDefaults | 92 | null |
openapi-generators/openapi-python-client | from typing import Literal
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestStringEnumClass:
@pytest.mark.parametrize(
"expected_name,ex... | MyEnum(expected_value) | assert | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py | test_enum_values | TestStringEnumClass | 50 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestBasicModelProperties:
def test_type_hints(self, MyModel):
... | "Any | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_type_hints | TestBasicModelProperties | 143 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_enum_bad_default_type(self, generated_client):
assert_bad_schema(generated_client, "WithBadDefaultType", | "Cannot convert 123 to enum") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_enum_bad_default_type | TestEnumAndConstInvalidSchemas | 42 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_disambiguate_objects_via_required_properties(self, ThingA, ThingB, ModelWithUnion):
a... | ModelWithUnion(thing=ThingA(prop_a="x"))) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_disambiguate_objects_via_required_properties | TestOneOf | 95 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestSchemaDocstrings:
def test_model_properties(self, MyModel):
assert set(DocstringParser(MyModel).get_section("Attributes:")) == | { "req_str (str): This is necessary.", "opt_str (str | Unset): This isn't necessary.", "undescribed_prop (str):", } | assert | collection | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_model_properties | TestSchemaDocstrings | 44 | null |
openapi-generators/openapi-python-client | import pytest
from end_to_end_tests.functional_tests.helpers import (
inline_spec_should_fail,
)
class TestInvalidSpecFormats:
@pytest.mark.parametrize(
("filename_suffix", "content", "expected_error"),
(
(".yaml", "not a valid openapi document", "Failed to parse OpenAPI document"),... | result.output | assert | complex_expr | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_spec_format.py | test_unparseable_file | TestInvalidSpecFormats | 19 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | warnings.by_schema | assert | complex_expr | end_to_end_tests/functional_tests/helpers.py | assert_bad_schema | 108 | null | |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraysWithPrefixItems:
def test_type_hints(self, ModelWithSinglePrefixItem, ModelWithPrefixItems, ModelWithMi... | "list[str] | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_type_hints | TestArraysWithPrefixItems | 129 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestSpecialStringFormats:
def test_unknown_format(self, MyModel):
... | MyModel(unknown_format_prop="whatever")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_unknown_format | TestSpecialStringFormats | 180 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_type_hints(self, ModelWithUnion, ModelWithRequiredUnion, ModelWithUnionOfOne, ThingA):
... | "ThingA | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_type_hints | TestOneOf | 141 | null |
openapi-generators/openapi-python-client | import pytest
from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestReferenceSchemaProperties:
def test_decode_encode(self, generated_client):
assert "Circular schema references found" in | generated_client.generator_result.stderr | assert | complex_expr | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_references.py | test_decode_encode | TestReferenceSchemaProperties | 29 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestSimpleTypeList:
def test_type_hints(self, MyModel):
assert_model_property_type_hint(MyModel, "string... | "int | str | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_type_hints | TestSimpleTypeList | 31 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | expected_instance | assert | variable | end_to_end_tests/functional_tests/helpers.py | assert_model_decode_encode | 71 | null | |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_conflicting_inline_class_names(self, generated_client):
assert "Found conflicting enums named WithConflictingInli... | generated_client.generator_result.output | assert | complex_expr | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_conflicting_inline_class_names | TestEnumAndConstInvalidSchemas | 54 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestUnionInvalidSchemas:
def test_invalid_reference(self, generated_client):
assert_bad_schema(generated_client, "UnionWithInvalidReference", | "Could not find reference") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py | test_invalid_reference | TestUnionInvalidSchemas | 22 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestRequiredAndOptionalProperties:
def test_required_ok(self, MyModel, ... | DerivedModel(req1="a", req2="b", req3="c")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_required_ok | TestRequiredAndOptionalProperties | 45 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestSpecialStringFormats:
def test_date_time(self, MyModel):
d... | MyModel(date_time_prop=date_time_value)) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_date_time | TestSpecialStringFormats | 171 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestEndpointDocstrings:
def test_request_body(self, post_simple_thing_sync):
assert DocstringParser(post_simple_thing_sync).get_section("Args:") == | [ "body (Thing | Unset): The thing." ] | assert | collection | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_request_body | TestEndpointDocstrings | 154 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestSchemaDocstrings:
def test_model_description(self, MyModel):
assert DocstringParser(MyModel).lines[0] == | "I like this type." | assert | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_model_description | TestSchemaDocstrings | 41 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestUnionInvalidSchemas:
def test_invalid_default(self, generated_client):
assert_bad_schema(generated_client, "UnionWithInvalidDefault", | "Invalid int value: aaa") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py | test_invalid_default | TestUnionInvalidSchemas | 25 | null |
openapi-generators/openapi-python-client | from typing import Literal
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestStringEnumClass:
def test_type_hints(self, MyModel, MyModelWithRequ... | optional_type) | assert_* | variable | end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py | test_type_hints | TestStringEnumClass | 62 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_disambiguate_objects_via_required_properties(self, ThingA, ThingB, ModelWithUnion):
as... | ModelWithUnion(thing=ThingB(prop_b="x"))) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_disambiguate_objects_via_required_properties | TestOneOf | 100 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | 0 | assert | numeric_literal | end_to_end_tests/functional_tests/helpers.py | inline_spec_should_fail | 98 | null | |
openapi-generators/openapi-python-client | from typing import Literal
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestStringEnumClass:
def test_invalid_values(self, MyModel):
w... | ValueError) | pytest.raises | variable | end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py | test_invalid_values | TestStringEnumClass | 66 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestSpecialStringFormats:
def test_uuid(self, MyModel):
uuid_v... | MyModel(uuid_prop=uuid_value)) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_uuid | TestSpecialStringFormats | 176 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_type_hints(self, ModelWithUnion, ModelWithRequiredUnion, ModelWithUnionOfOne, ThingA):
... | "ThingA | ThingB | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_type_hints | TestOneOf | 131 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestRequiredAndOptionalProperties:
def test_required_ok(self, MyModel, ... | MyModel(req1="a", req2="b")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_required_ok | TestRequiredAndOptionalProperties | 40 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_disambiguate_nested_union(self, ThingA, ThingB, ModelWithNestedUnion):
asse | ModelWithNestedUnion(thing_or_value=ThingA(prop_a="x"))) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_disambiguate_nested_union | TestOneOf | 119 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraySchemas:
def test_type_hints(self, ModelWithArrayOfAny, ModelWithArrayOfInts, ModelWithArrayOfObjects):
... | "list[int] | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_type_hints | TestArraySchemas | 63 | null |
openapi-generators/openapi-python-client | import pytest
from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestArrayInvalidSchemas:
def test_no_items(self, generated_client):
assert_bad_schema(generated_client, "ArrayWithNoItems", | "must have items or prefixItems defined") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_arrays.py | test_no_items | TestArrayInvalidSchemas | 20 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
from end_to_end_tests.functional_tests.helpers import (
with_generated_client_fixture,
with_generated_code_imports,
)
class TestLiteralEnumDefaults:
def test_default_value(self, MyModel):
assert MyModel().enum_prop == | "A" | assert | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_defaults.py | test_default_value | TestLiteralEnumDefaults | 114 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_enum_mixed_types(self, generated_client):
assert_bad_schema(generated_client, "WithMixedTypes", | "Enum values must all be the same type") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_enum_mixed_types | TestEnumAndConstInvalidSchemas | 45 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_const_default_not_matching(self, generated_client):
assert_bad_schema(generated_client, "DefaultNotMatchingConst"... | "Invalid value for const") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_const_default_not_matching | TestEnumAndConstInvalidSchemas | 51 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraysWithPrefixItems:
def test_prefix_items_and_regular_items(self, ModelWithMixedItems, SimpleObject):
... | ModelWithMixedItems(array_prop=[SimpleObject(name="a"), "b"])) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_prefix_items_and_regular_items | TestArraysWithPrefixItems | 122 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_disambiguate_nested_union(self, ThingA, ThingB, ModelWithNestedUnion):
assert_model_d... | ModelWithNestedUnion(thing_or_value=3)) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_disambiguate_nested_union | TestOneOf | 124 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraySchemas:
def test_type_hints(self, ModelWithArrayOfAny, ModelWithArrayOfInts, ModelWithArrayOfObjects):
... | "list[SimpleObject] | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_type_hints | TestArraySchemas | 64 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_disambiguate_object_and_non_object(self, ThingA, ModelWithUnion):
assert_model_decode... | ModelWithUnion(thing_or_string="x")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_disambiguate_object_and_non_object | TestOneOf | 112 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestOneOf:
def test_type_hints(self, ModelWithUnion, ModelWithRequiredUnion, ModelWithUnionOfOne, ThingA):
... | "ThingA") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_type_hints | TestOneOf | 144 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | json_data | assert | variable | end_to_end_tests/functional_tests/helpers.py | assert_model_decode_encode | 72 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.