Skip to content

Commit

Permalink
add test for docstring generation
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Jan 17, 2024
1 parent ee881c0 commit e3260fd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/unit/utils_test/test_docval.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,17 @@ def test_enum_forbidden_values(self):
def method(self, **kwargs):
pass

def test_nested_return_types(self):
"""Test that having nested tuple rtype creates valid sphinx references"""
@docval({'name': 'arg1', 'type': int, 'doc': 'an arg'},
returns='output', rtype=(list, (list, bool), (list, 'Test')))
def method(self, **kwargs):
return []

doc = ('method(arg1)\n\n\n\nArgs:\n arg1 (:py:class:`~int`): an arg\n\nReturns:\n '
':py:class:`~list` or :py:class:`~list`, :py:class:`~bool` or :py:class:`~list`, Test: output')
self.assertEqual(method.__doc__, doc)


class TestDocValidatorChain(TestCase):

Expand Down

0 comments on commit e3260fd

Please sign in to comment.