File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,11 @@ def _parse_multiline_annotations(lines: Collection[str]) -> AnnotDict:
137137 key = line
138138 result [key ] = True
139139 else :
140- break
140+ # Allow empty lines between annotations, but stop on non-empty non-comment lines
141+ if line .strip ():
142+ break
143+ # Continue parsing if it's just an empty line
144+ in_annot_context = False
141145
142146 # make sure wrap-doc is always a Code object
143147 if "wrap-doc" in result .keys ():
Original file line number Diff line number Diff line change @@ -612,3 +612,33 @@ def test_multiline_docs():
612612 assert result ["wrap-doc" ].content [0 ] == "first line"
613613 assert result ["wrap-doc" ].content [1 ] == " second line indented"
614614 assert result ["wrap-doc" ].content [2 ] == ""
615+
616+
617+ def test_consecutive_multiline_annotations ():
618+ """Test that consecutive multiline annotations separated by empty lines are parsed correctly."""
619+ (cdcl ,) = autowrap .PXDParser .parse_str (
620+ """
621+ cdef extern from "*":
622+ cdef cppclass LinearInterpolation[V,W]:
623+ # wrap-doc:
624+ # Linear interpolation for gridded data
625+ # Supports various interpolation methods
626+
627+ # wrap-instances:
628+ # LinearInterpolation := LinearInterpolation[double, double]
629+
630+ pass
631+ """
632+ )
633+
634+ # Verify both annotations were parsed
635+ assert "wrap-doc" in cdcl .annotations
636+ assert "wrap-instances" in cdcl .annotations
637+
638+ # Verify wrap-doc content
639+ expected_doc_content = ["Linear interpolation for gridded data" , "Supports various interpolation methods" ]
640+ assert cdcl .annotations ["wrap-doc" ].content == expected_doc_content
641+
642+ # Verify wrap-instances content
643+ expected_instances = ["LinearInterpolation := LinearInterpolation[double, double]" ]
644+ assert cdcl .annotations ["wrap-instances" ] == expected_instances
You can’t perform that action at this time.
0 commit comments