Merge pull request #7262 from tk0miya/testcase_for_py

test: Add testcase for special case of PythonDomain.find_obj()
This commit is contained in:
Takeshi KOMIYA 2020-03-07 23:18:07 +09:00 committed by GitHub
commit 372813a137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -51,3 +51,11 @@ module
.. py:attribute:: attr2 .. py:attribute:: attr2
:type: :doc:`index` :type: :doc:`index`
.. py:module:: exceptions
.. py:exception:: Exception
.. py:module:: object
.. py:function:: sum()

View File

@ -206,6 +206,18 @@ def test_domain_py_find_obj(app, status, warning):
[('NestedParentA.NestedChildA.subchild_1', [('NestedParentA.NestedChildA.subchild_1',
('roles', 'nestedparenta-nestedchilda-subchild-1', 'method'))]) ('roles', 'nestedparenta-nestedchilda-subchild-1', 'method'))])
# special case: exceptions
assert (find_obj('exceptions', None, 'Exception', 'exc') ==
[('exceptions.Exception', ('module', 'exceptions-exception', 'exception'))])
assert (find_obj(None, None, 'Exception', 'exc') ==
[('exceptions.Exception', ('module', 'exceptions-exception', 'exception'))])
# special case: object
assert (find_obj('object', None, 'sum', 'func') ==
[('object.sum', ('module', 'object-sum', 'function'))])
assert (find_obj(None, None, 'sum', 'func') ==
[('object.sum', ('module', 'object-sum', 'function'))])
def test_get_full_qualified_name(): def test_get_full_qualified_name():
env = Mock(domaindata={}) env = Mock(domaindata={})