Skip to content

Commit 33608e9

Browse files
committed
Update test cases
1 parent 08b75a0 commit 33608e9

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

tests/test_example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ def test_readme_example():
2020
def readme_example_1() -> OpenAPI:
2121
"""Construct OpenAPI using data class"""
2222
return OpenAPI(
23-
info=Info(title="My own API", version="v0.0.1",),
23+
info=Info(
24+
title="My own API",
25+
version="v0.0.1",
26+
),
2427
paths={"/ping": PathItem(get=Operation(responses={"200": Response(description="pong")}))},
2528
)
2629

tests/test_util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def construct_base_open_api_1() -> OpenAPI:
6767

6868
def construct_base_open_api_2() -> OpenAPI:
6969
return OpenAPI(
70-
info=Info(title="My own API", version="v0.0.1",),
70+
info=Info(
71+
title="My own API",
72+
version="v0.0.1",
73+
),
7174
paths={
7275
"/ping": PathItem(
7376
post=Operation(
@@ -96,7 +99,10 @@ def construct_base_open_api_2() -> OpenAPI:
9699

97100
def construct_base_open_api_3() -> OpenAPI:
98101
return OpenAPI(
99-
info=Info(title="My own API", version="v0.0.1",),
102+
info=Info(
103+
title="My own API",
104+
version="v0.0.1",
105+
),
100106
paths={
101107
"/ping": PathItem(
102108
post=Operation(

tests/v3_0_3/test_util.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
from pydantic import BaseModel, Field
44

5-
from openapi_schema_pydantic.v3.v3_0_3 import Info, MediaType, OpenAPI, Operation, PathItem, Reference, RequestBody, Response
5+
from openapi_schema_pydantic.v3.v3_0_3 import (
6+
Info,
7+
MediaType,
8+
OpenAPI,
9+
Operation,
10+
PathItem,
11+
Reference,
12+
RequestBody,
13+
Response,
14+
)
615
from openapi_schema_pydantic.v3.v3_0_3.util import PydanticSchema, construct_open_api_with_schema_class
716

817

@@ -96,7 +105,10 @@ def construct_base_open_api_2() -> OpenAPI:
96105

97106
def construct_base_open_api_3() -> OpenAPI:
98107
return OpenAPI(
99-
info=Info(title="My own API", version="v0.0.1",),
108+
info=Info(
109+
title="My own API",
110+
version="v0.0.1",
111+
),
100112
paths={
101113
"/ping": PathItem(
102114
post=Operation(

tests/v3_1_0/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from openapi_schema_pydantic.v3.v3_1_0.schema import Schema
2+
3+
4+
def test_empty_schema():
5+
schema = Schema.parse_obj({})
6+
assert schema == Schema()

0 commit comments

Comments
 (0)