Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Sep 14, 2020
1 parent 4dd668a commit 0e0fe37
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 85 deletions.
4 changes: 2 additions & 2 deletions tests/test_autodoc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# this package
from attr_utils.annotations import AttrsClass
from attr_utils.autoattrs import AttrsDocumenter


def test_can_document():
assert AttrsDocumenter.can_document_member(AttrsClass, None, None, None)
assert AttrsDocumenter.can_document_member(AttrsClass, "AttrsClass", False, None)
5 changes: 4 additions & 1 deletion tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def test_add_attrs_doc():
assert SomeClass.__gt__.__doc__ == doc
assert SomeClass.__lt__.__doc__ == doc
assert SomeClass.__le__.__doc__ == doc
assert SomeClass.__ne__.__doc__ == "\n Check equality and either forward a NotImplemented or return the result\n negated.\n "
assert SomeClass.__ne__.__doc__ in {
"Return ``self != other``.",
"\n Check equality and either forward a NotImplemented or return the result\n negated.\n ",
}
assert SomeClass.__repr__.__doc__ == doc
else:

Expand Down
4 changes: 0 additions & 4 deletions tests/test_output/doc-test/test-root/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@
github_username = "domdfcoding"
github_repository = "sphinx-toolbox"
source_link_target = "GitHub"

autodoc_default_options = {
"exclude-members": "__repr__",
}
2 changes: 2 additions & 0 deletions tests/test_output/doc-test/test-root/docstrings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ The Sphinx output looks like:

.. automodule:: attr_utils.annotations
:members: AttrsClass
:exclude-members: __init__
:special-members:

.. autoattrs:: attr_utils.annotations.AttrsClass
:members:
:exclude-members: __init__
:special-members:
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ <h3 id="searchlabel">
</div>
</div>
</body>
</html>
</html>
164 changes: 87 additions & 77 deletions tests/test_output/test_output/test_html_output_docstrings_html_.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,44 +570,6 @@ <h2>
</dl>
</dd>
</dl>
<dl class="py method">
<dt id="attr_utils.annotations.AttrsClass.__init__">
<code class="sig-name descname">
__init__
</code>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
name
</span>
</em>
,
<em class="sig-param">
<span class="n">
age
</span>
</em>
,
<em class="sig-param">
<span class="n">
occupations
</span>
</em>
<span class="sig-paren">
)
</span>
<a class="headerlink" href="#attr_utils.annotations.AttrsClass.__init__" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Method generated by attrs for class AttrsClass.
</p>
</dd>
</dl>
<dl class="py method">
<dt id="attr_utils.annotations.AttrsClass.__le__">
<code class="sig-name descname">
Expand Down Expand Up @@ -764,6 +726,49 @@ <h2>
</dl>
</dd>
</dl>
<dl class="py method">
<dt id="attr_utils.annotations.AttrsClass.__repr__">
<code class="sig-name descname">
__repr__
</code>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
<a class="headerlink" href="#attr_utils.annotations.AttrsClass.__repr__" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return a string representation of the
<a class="reference internal" href="#id5" title="attr_utils.annotations.AttrsClass">
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
AttrsClass
</span>
</code>
</a>
.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Return type
</dt>
<dd class="field-odd">
<p>
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
str
</span>
</code>
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py attribute">
<dt id="attr_utils.annotations.AttrsClass.__weakref__">
<code class="sig-name descname">
Expand Down Expand Up @@ -1050,26 +1055,14 @@ <h2>
<dl class="py method">
<dt id="id10">
<code class="sig-name descname">
__init__
__le__
</code>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
name
</span>
</em>
,
<em class="sig-param">
<span class="n">
age
</span>
</em>
,
<em class="sig-param">
<span class="n">
occupations
other
</span>
</em>
<span class="sig-paren">
Expand All @@ -1081,14 +1074,40 @@ <h2>
</dt>
<dd>
<p>
Method generated by attrs for class AttrsClass.
Return
<code class="docutils literal notranslate">
<span class="pre">
self
</span>
<span class="pre">
&lt;=
</span>
<span class="pre">
other
</span>
</code>
.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Return type
</dt>
<dd class="field-odd">
<p>
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
bool
</span>
</code>
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt id="id11">
<code class="sig-name descname">
__le__
__lt__
</code>
<span class="sig-paren">
(
Expand All @@ -1113,7 +1132,7 @@ <h2>
self
</span>
<span class="pre">
&lt;=
&lt;
</span>
<span class="pre">
other
Expand All @@ -1140,7 +1159,7 @@ <h2>
<dl class="py method">
<dt id="id12">
<code class="sig-name descname">
__lt__
__ne__
</code>
<span class="sig-paren">
(
Expand All @@ -1165,7 +1184,7 @@ <h2>
self
</span>
<span class="pre">
&lt;
!=
</span>
<span class="pre">
other
Expand All @@ -1192,16 +1211,11 @@ <h2>
<dl class="py method">
<dt id="id13">
<code class="sig-name descname">
__ne__
__repr__
</code>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
other
</span>
</em>
<span class="sig-paren">
)
</span>
Expand All @@ -1211,18 +1225,14 @@ <h2>
</dt>
<dd>
<p>
Return
<code class="docutils literal notranslate">
<span class="pre">
self
</span>
<span class="pre">
!=
</span>
<span class="pre">
other
</span>
</code>
Return a string representation of the
<a class="reference internal" href="#id5" title="attr_utils.annotations.AttrsClass">
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
AttrsClass
</span>
</code>
</a>
.
</p>
<dl class="field-list simple">
Expand All @@ -1233,7 +1243,7 @@ <h2>
<p>
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
bool
str
</span>
</code>
</p>
Expand Down Expand Up @@ -1308,4 +1318,4 @@ <h3 id="searchlabel">
</div>
</div>
</body>
</html>
</html>

0 comments on commit 0e0fe37

Please sign in to comment.