Allow for no exceptions to be raised and cleanup

Allow for no exceptions to be raised

Add some helpful comments

Remove doctest skips

Remove TODO note

Cleanup and skip failing doctest
This commit is contained in:
Steven Silvester
2014-12-23 16:51:18 -06:00
parent c0a0490eed
commit 2d3ada19e5
10 changed files with 26 additions and 32 deletions
+5 -2
View File
@@ -85,12 +85,15 @@ def expected_warnings(matching):
Uses `all_warnings` to ensure all warnings are raised.
Upon exiting, it checks the recorded warnings for the desired matching
string. Raises a warning if the match was not found or an Unexpected
warning is found.
warning is found. You can pass an empty regex as on of the matches
to allow for no matches: "\A\Z".
"""
with all_warnings() as w:
# enter context
yield w
remaining = [m for m in matching]
# exited user context, check the recorded warnings
remaining = [m for m in matching if not '\A\Z' in m.split('|')]
for warn in w:
found = False
for match in matching: