mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 08:25:01 -05:00
fix tests for autodoc novalue option
In the tests for autodoc the Options are of type struct, while in the code there is a special autodoc.Options class, which is a dict. So "novalue" in self.options doesn't work, but self.options.novalue does work for both. Additionally the logic for autoattribute was wrong and is fixed now.
This commit is contained in:
1 parent
391f99d13a
commit
ffb825d733
2 files changed
+3
-2
No files matched your search
@@ -1106,7 +1106,7 @@ class DataDocumenter(ModuleLevelDocumenter):
|
||||
|
||||
def add_directive_header(self, sig):
|
||||
ModuleLevelDocumenter.add_directive_header(self, sig)
|
||||
if not "novalue" in self.options:
|
||||
if not self.options.novalue:
|
||||
try:
|
||||
objrepr = safe_repr(self.object)
|
||||
except ValueError:
|
||||
@@ -1221,7 +1221,7 @@ class AttributeDocumenter(ClassLevelDocumenter):
|
||||
|
||||
def add_directive_header(self, sig):
|
||||
ClassLevelDocumenter.add_directive_header(self, sig)
|
||||
if not self._datadescriptor or "novalue" in self.options:
|
||||
if not self._datadescriptor and not self.options.novalue:
|
||||
try:
|
||||
objrepr = safe_repr(self.object)
|
||||
except ValueError:
|
||||
|
||||
@@ -38,6 +38,7 @@ def setup_module():
|
||||
special_members = False,
|
||||
show_inheritance = False,
|
||||
noindex = False,
|
||||
novalue = False,
|
||||
synopsis = '',
|
||||
platform = '',
|
||||
deprecated = False,
|
||||
|
||||
Reference in new issue
Block a user