diff --git a/autoapi/_parser.py b/autoapi/_parser.py index 710d432c..3b58d06f 100644 --- a/autoapi/_parser.py +++ b/autoapi/_parser.py @@ -335,7 +335,7 @@ def parse_typealias(self, node): return [data] def parse(self, node): - data = {} + data = [] node_type = node.__class__.__name__.lower() parse_func = getattr(self, "parse_" + node_type, None) diff --git a/docs/changes/+f5e49f9f.misc.rst b/docs/changes/+f5e49f9f.misc.rst new file mode 100644 index 00000000..ea14abd7 --- /dev/null +++ b/docs/changes/+f5e49f9f.misc.rst @@ -0,0 +1 @@ +Fix the parser returning a dictionary instead of a list in the empty parse scenario diff --git a/tests/python/test_parser.py b/tests/python/test_parser.py index fb4d28b8..288ad9c2 100644 --- a/tests/python/test_parser.py +++ b/tests/python/test_parser.py @@ -39,7 +39,7 @@ def test_parses_all_multiline(self): def test_parses_name(self): source = "foo.bar" - assert self.parse(source) == {} + assert self.parse(source) == [] def test_parses_list(self): name = "__all__"