Adding upstream version 0.5.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
303fa6e9d8
commit
97e6d74bac
110 changed files with 12006 additions and 0 deletions
6
tests/v3_1/__init__.py
Normal file
6
tests/v3_1/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from openapi_pydantic.v3.v3_1.schema import Schema, schema_validate
|
||||
|
||||
|
||||
def test_empty_schema() -> None:
|
||||
schema = schema_validate({})
|
||||
assert schema == Schema()
|
35
tests/v3_1/test_datatype.py
Normal file
35
tests/v3_1/test_datatype.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from openapi_pydantic.v3.v3_1 import Schema
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"datatype",
|
||||
(
|
||||
"string",
|
||||
"number",
|
||||
"integer",
|
||||
"boolean",
|
||||
"array",
|
||||
"object",
|
||||
"null",
|
||||
),
|
||||
)
|
||||
def test_good_types_parse_and_equate(datatype: str) -> None:
|
||||
assert Schema(type=datatype).type == datatype
|
||||
|
||||
|
||||
def test_bad_types_raise_validation_errors() -> None:
|
||||
with pytest.raises(ValidationError):
|
||||
Schema(type="invalid")
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
Schema(anyOf=[{"type": "invalid"}])
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
Schema(
|
||||
properties={
|
||||
"a": Schema(type="invalid"),
|
||||
},
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue