-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'matthew-brett-py35-testing' into maint/0.10.x
- Loading branch information
Showing
4 changed files
with
37 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" Testing tripwire module. | ||
""" | ||
|
||
from ..tripwire import TripWire, is_tripwire, TripWireError | ||
|
||
from nose import SkipTest | ||
from nose.tools import (assert_true, assert_false, assert_raises, | ||
assert_equal, assert_not_equal) | ||
|
||
|
||
def test_is_tripwire(): | ||
assert_false(is_tripwire(object())) | ||
assert_true(is_tripwire(TripWire('some message'))) | ||
|
||
|
||
def test_tripwire(): | ||
# Test tripwire object | ||
silly_module_name = TripWire('We do not have silly_module_name') | ||
assert_raises(TripWireError, | ||
getattr, | ||
silly_module_name, | ||
'do_silly_thing') | ||
# Check AttributeError can be checked too | ||
try: | ||
silly_module_name.__wrapped__ | ||
except TripWireError as err: | ||
assert_true(isinstance(err, AttributeError)) | ||
else: | ||
raise RuntimeError("No error raised, but expected") |
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