-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from DavidCEllis/quieten_warnings
Quieten warnings
- Loading branch information
Showing
4 changed files
with
22 additions
and
11 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
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,12 +1,19 @@ | ||
import warnings | ||
from fuzzywuzzy import process | ||
|
||
|
||
def test_process_warning(): | ||
"""Check that a string reduced to 0 by processor raises a warning""" | ||
def test_process_warning(capsys): | ||
"""Check that a string reduced to 0 by processor logs a warning to stderr""" | ||
|
||
query = ':::::::' | ||
choices = [':::::::'] | ||
with warnings.catch_warnings(record=True) as w: | ||
result = process.extractOne(query, choices) | ||
assert issubclass(w[-1].category, UserWarning) | ||
assert result == (query, 0) | ||
|
||
_ = process.extractOne(query, choices) | ||
|
||
out, err = capsys.readouterr() | ||
|
||
outstr = ("WARNING:root:Applied processor reduces " | ||
"input query to empty string, " | ||
"all comparisons will have score 0. " | ||
"[Query: ':::::::']\n") | ||
|
||
assert err == outstr |