@@ -367,6 +367,12 @@ def test_returns_section(parse_numpy: ParserType) -> None:
367367 flag : bool
368368 Some kind
369369 of flag.
370+ x :
371+ Name only
372+ :
373+ No name or annotation
374+ : int
375+ Only annotation
370376 """
371377
372378 sections , _ = parse_numpy (docstring )
@@ -377,7 +383,22 @@ def test_returns_section(parse_numpy: ParserType) -> None:
377383 )
378384 assert_element_equal (
379385 sections [0 ].value [1 ],
380- DocstringReturn (name = "" , annotation = "bool" , description = "Some kind\n of flag." ),
386+ DocstringReturn (name = "flag" , annotation = "bool" , description = "Some kind\n of flag." ),
387+ )
388+
389+ assert_element_equal (
390+ sections [0 ].value [2 ],
391+ DocstringReturn (name = "x" , annotation = None , description = "Name only" ),
392+ )
393+
394+ assert_element_equal (
395+ sections [0 ].value [3 ],
396+ DocstringReturn (name = "" , annotation = None , description = "No name or annotation" ),
397+ )
398+
399+ assert_element_equal (
400+ sections [0 ].value [4 ],
401+ DocstringReturn (name = "" , annotation = "int" , description = "Only annotation" ),
381402 )
382403
383404
@@ -405,7 +426,7 @@ def test_yields_section(parse_numpy: ParserType) -> None:
405426 )
406427 assert_element_equal (
407428 sections [0 ].value [1 ],
408- DocstringYield (name = "" , annotation = "bool" , description = "Some kind\n of flag." ),
429+ DocstringYield (name = "flag " , annotation = "bool" , description = "Some kind\n of flag." ),
409430 )
410431
411432
@@ -433,7 +454,7 @@ def test_receives_section(parse_numpy: ParserType) -> None:
433454 )
434455 assert_element_equal (
435456 sections [0 ].value [1 ],
436- DocstringReceive (name = "" , annotation = "bool" , description = "Some kind\n of flag." ),
457+ DocstringReceive (name = "flag " , annotation = "bool" , description = "Some kind\n of flag." ),
437458 )
438459
439460
0 commit comments