22import uuid
33from datetime import date , datetime , timedelta
44from ipaddress import IPv4Address
5+ from pathlib import Path
56from typing import (
67 Annotated ,
78 Any ,
@@ -100,21 +101,21 @@ class SpecialTypesModel(BaseModel):
100101 datetime_field : datetime
101102 date_field : date
102103 timedelta_field : timedelta
103- # path_field: Path
104+ path_field : Path
104105 uuid_field : uuid .UUID
105106 ip_field : IPv4Address
106107
107108 def _check_instance (self ):
108109 assert isinstance (self .datetime_field , datetime )
109110 assert isinstance (self .date_field , date )
110111 assert isinstance (self .timedelta_field , timedelta )
111- # assert isinstance(self.path_field, Path)
112+ assert isinstance (self .path_field , Path )
112113 assert isinstance (self .uuid_field , uuid .UUID )
113114 assert isinstance (self .ip_field , IPv4Address )
114115 assert self .datetime_field == datetime (2000 , 1 , 2 , 3 , 4 , 5 )
115116 assert self .date_field == date (2000 , 1 , 2 )
116117 assert self .timedelta_field == timedelta (days = 1 , hours = 2 )
117- # assert self.path_field == Path("test/path")
118+ assert self .path_field == Path ("test/path" )
118119 assert self .uuid_field == uuid .UUID ("12345678-1234-5678-1234-567812345678" )
119120 assert self .ip_field == IPv4Address ("127.0.0.1" )
120121
@@ -124,7 +125,7 @@ def make_special_types_object() -> SpecialTypesModel:
124125 datetime_field = datetime (2000 , 1 , 2 , 3 , 4 , 5 ),
125126 date_field = date (2000 , 1 , 2 ),
126127 timedelta_field = timedelta (days = 1 , hours = 2 ),
127- # path_field=Path("test/path"),
128+ path_field = Path ("test/path" ),
128129 uuid_field = uuid .UUID ("12345678-1234-5678-1234-567812345678" ),
129130 ip_field = IPv4Address ("127.0.0.1" ),
130131 )
0 commit comments