Skip to content

Commit

Permalink
add additional unit test to check StopIteration condition
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Narayana <[email protected]>
  • Loading branch information
harshanarayana committed Nov 8, 2018
1 parent 30759a9 commit 7e86025
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_blueprint_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
AUTH = "dGVzdDp0ZXN0Cg=="


def test_bp_group_iterate_with_next(app: Sanic):
blueprint_1 = Blueprint('blueprint_1', url_prefix="/bp1")
blueprint_2 = Blueprint('blueprint_2', url_prefix='/bp2')

group = Blueprint.group(blueprint_1, blueprint_2, url_prefix="/api")

assert next(group).url_prefix == "/api/bp1"

assert next(group).url_prefix == "/api/bp2"

with raises(expected_exception=StopIteration) as e:
next(group)


def test_bp_group_indexing(app: Sanic):
blueprint_1 = Blueprint('blueprint_1', url_prefix="/bp1")
blueprint_2 = Blueprint('blueprint_2', url_prefix='/bp2')
Expand Down

0 comments on commit 7e86025

Please sign in to comment.