-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an error message that is printed when the user supplies an invalid column to prevent unwanted calculations and user-visible exceptions. Also add tests to ensure that the error message is printed to stderr. Closes #1
- Loading branch information
1 parent
1d9b976
commit 6f2b0d3
Showing
4 changed files
with
132 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import io | ||
import sys | ||
|
||
def capture_stderr(func): | ||
err, sys.stderr = sys.stderr, io.StringIO() | ||
value = None | ||
try: | ||
ret = func(None) | ||
sys.stderr.seek(0) | ||
value = (ret, sys.stderr.read()) | ||
finally: | ||
sys.stderr = err | ||
|
||
return value |