File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
tests/functional/event_handler Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1
1
from dataclasses import dataclass
2
2
from typing import List
3
3
4
+ import pytest
4
5
from pydantic import BaseModel
5
6
from pydantic .color import Color
6
7
7
8
from aws_lambda_powertools .event_handler .openapi .encoders import jsonable_encoder
8
9
9
10
11
+ @pytest .fixture
12
+ def pydanticv1_only ():
13
+ from pydantic import __version__
14
+
15
+ version = __version__ .split ("." )
16
+ if version [0 ] != "1" :
17
+ pytest .skip ("pydanticv1 test only" )
18
+
19
+
10
20
def test_openapi_encode_include ():
11
21
class User (BaseModel ):
12
22
name : str
@@ -37,6 +47,7 @@ class User(BaseModel):
37
47
assert result == {"name" : "John" , "order" : {"quantity" : 2 }}
38
48
39
49
50
+ @pytest .mark .usefixtures ("pydanticv1_only" )
40
51
def test_openapi_encode_pydantic_root_types ():
41
52
class User (BaseModel ):
42
53
__root__ : List [str ]
You can’t perform that action at this time.
0 commit comments