@@ -136,21 +136,29 @@ def test_literals(self, doctype, expected):
136136 @pytest .mark .parametrize (
137137 ("doctype" , "expected" ),
138138 [
139- ("int, optional" , "int" ),
140- ("int | None, optional" , "int | None" ),
141- ("int, default -1" , "int" ),
142- ("int, default = 1" , "int" ),
143- ("int, default: 0" , "int" ),
144- ("float, default: 1.0" , "float" ),
145- ("{'a', 'b'}, default : 'a'" , "Literal['a', 'b']" ),
139+ ("int" , "int" ),
140+ ("int | None" , "int | None" ),
141+ ("tuple of (int, float)" , "tuple[int, float]" ),
142+ ("{'a', 'b'}" , "Literal['a', 'b']" ),
146143 ],
147144 )
148- @pytest .mark .parametrize ("extra_info" , [None , "int" , ", extra, info" ])
149- def test_optional_extra_info (self , doctype , expected , extra_info ):
150- if extra_info :
151- doctype = f"{ doctype } , { extra_info } "
145+ @pytest .mark .parametrize (
146+ "extra_info" ,
147+ [
148+ "" ,
149+ ", optional" ,
150+ ", default -1" ,
151+ ", default: -1" ,
152+ ", default = 1" ,
153+ ", in range (0, 1), optional" ,
154+ ", optional, in range [0, 1]" ,
155+ ", see parameter `image`, optional" ,
156+ ],
157+ )
158+ def test_extra_info (self , doctype , expected , extra_info ):
159+ doctype_with_extra = doctype + extra_info
152160 transformer = DoctypeTransformer ()
153- annotation , _ = transformer .doctype_to_annotation (doctype )
161+ annotation , _ = transformer .doctype_to_annotation (doctype_with_extra )
154162 assert annotation .value == expected
155163
156164 @pytest .mark .parametrize (
0 commit comments