projects
/
swc-testing-nose.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
653b835
)
Example of using @raises to test the raising of an exception.
author
Ben Waugh
<b.waugh@ucl.ac.uk>
Thu, 11 Apr 2013 08:52:21 +0000
(09:52 +0100)
committer
W. Trevor King
<wking@tremily.us>
Fri, 1 Nov 2013 20:42:52 +0000
(13:42 -0700)
testing/cheat-sheet.md
patch
|
blob
|
history
diff --git
a/testing/cheat-sheet.md
b/testing/cheat-sheet.md
index 140e098658cecc8add0d8aa38d179b3186d61658..d7f48a02f1c1a793fb437de7398af3438fb30bf9 100644
(file)
--- a/
testing/cheat-sheet.md
+++ b/
testing/cheat-sheet.md
@@
-86,9
+86,15
@@
the way values are represented and rounded.
### Testing exceptions
-TODO:
+Testing that a method raises the appropriate exception when the input is invalid:
+
+ from nose.tools import raises
+
+ from mystatscode import mean
-* using `@raises` decorator
+ @raises(TypeError)
+ def test_not_a_list():
+ observed = mean(1)
### Fixtures