File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -233,3 +233,27 @@ class B(BaseModel, A):
233233 extensions = Extensions (PydanticExtension (schema = False )),
234234 ) as package :
235235 assert "pydantic-field" in package ["B.a" ].labels
236+
237+
238+ @pytest .mark .skip (reason = "Currently not supported." )
239+ def test_annotated_fields () -> None :
240+ """Test the extension with annotated fields."""
241+ code = """
242+ from pydantic import BaseModel, Field
243+ from typing import Annotated
244+
245+ class Model(BaseModel):
246+ a: Annotated[int, Field(description="Some description.")]
247+ b: Annotated[int, Field(description="Another description.")] = 1
248+ """
249+ with temporary_visited_package (
250+ "package" ,
251+ modules = {"__init__.py" : code },
252+ extensions = Extensions (PydanticExtension (schema = False )),
253+ ) as package :
254+ assert package ["Model.a" ].is_attribute
255+ assert package ["Model.b" ].is_attribute
256+ assert "pydantic-field" in package ["Model.a" ].labels
257+ assert "pydantic-field" in package ["Model.b" ].labels
258+ assert package ["Model.a" ].docstring == "Some description."
259+ assert package ["Model.b" ].docstring == "Another description."
You can’t perform that action at this time.
0 commit comments