-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for AAA06 hash-comment resolution, improve examples (…
…#208) * Upgrade AAA05 bad example * Build out AAA05 doc #149 * Upgrade AAA06 bad examples * Add hash-comment example to AAA06 doc * Fix typing in AAA06 bad example * Fix mypy errors in AAA05 bad example * Update Changelog
- Loading branch information
1 parent
f23db69
commit 90a81d7
Showing
7 changed files
with
142 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,62 @@ | ||
AAA05: blank line in block | ||
-------------------------- | ||
========================== | ||
|
||
The only blank lines in the test must be around the Act block making it easy to | ||
spot. Flake8-AAA found additional blank lines which break up the block's | ||
layout. | ||
|
||
Resolution | ||
.......... | ||
Problematic code | ||
---------------- | ||
|
||
Remove the blank line. | ||
.. code-block:: python | ||
def test_a() -> None: | ||
x = 3 | ||
y = 4 | ||
result = x**2 + y**2 | ||
assert result == 25 | ||
.. code-block:: python | ||
def test_b() -> None: | ||
nothing = None | ||
with pytest.raises(AttributeError): | ||
nothing.get_something() | ||
Correct code | ||
------------ | ||
|
||
Remove the blank lines. | ||
|
||
.. code-block:: python | ||
def test_a() -> None: | ||
x = 3 | ||
y = 4 | ||
result = x**2 + y**2 | ||
assert result == 25 | ||
.. code-block:: python | ||
def test_b() -> None: | ||
nothing = None | ||
with pytest.raises(AttributeError): | ||
nothing.get_something() | ||
Rationale | ||
--------- | ||
|
||
Blank lines are essential for dividing up a test. There will usually be just | ||
two blank lines in each test - one above and one below the Act block. They | ||
serve to separate the Act block from the rest of the test. | ||
|
||
When there are additional blank lines in a test, then the "shape" of the test | ||
is broken and it is hard to see where the Act block is at a glance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters