summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/stdlib.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/tutorial/stdlib.rst')
-rw-r--r--Doc/tutorial/stdlib.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index 1343649..f6239d6 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -278,8 +278,10 @@ file::
def test_average(self):
self.assertEqual(average([20, 30, 70]), 40.0)
self.assertEqual(round(average([1, 5, 7]), 1), 4.3)
- self.assertRaises(ZeroDivisionError, average, [])
- self.assertRaises(TypeError, average, 20, 30, 70)
+ with self.assertRaises(ZeroDivisionError):
+ average([])
+ with self.assertRaises(TypeError):
+ average(20, 30, 70)
unittest.main() # Calling from the command line invokes all tests