Skip to content

Commit

Permalink
Merge pull request #155 from jamescooke/multi-assert-raises
Browse files Browse the repository at this point in the history
Add good example of multiple assert raises, fix pypi comment
  • Loading branch information
jamescooke committed Jun 7, 2020
2 parents 1e50a99 + 95ac6ba commit 3461f35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions examples/good/test_with_statement.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
from typing import Generator, List

import pytest

Expand Down Expand Up @@ -84,3 +85,16 @@ def test_with_in_assert(hello_world_path) -> None:

with open(hello_world_path) as f:
assert result == f.read()


def test_with_raises_in_assert() -> None:
"""
A generator with no items will raise StopIteration
"""
items: List[int] = []

result = (x for x in items)

assert isinstance(result, Generator)
with pytest.raises(StopIteration):
next(result)
2 changes: 1 addition & 1 deletion src/flake8_aaa/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
__author__ = 'James Cooke'
__copyright__ = '2018 - 2020, {}'.format(__author__)

__description__ = 'A linter for Python tests'
__description__ = 'A Flake8 plugin that checks Python tests follow the Arrange-Act-Assert pattern'
__email__ = 'github@jamescooke.info'

0 comments on commit 3461f35

Please sign in to comment.