Skip to content

Commit 9605e81

Browse files
author
Siddharta Govindaraj
committed
Testing for exceptions - assertRaises context manager
1 parent 563c418 commit 9605e81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stock_alerter/tests/test_stock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ def test_stock_update(self):
2020

2121
def test_negative_price_should_throw_ValueError(self):
2222
goog = Stock("GOOG")
23-
self.assertRaises(ValueError,
24-
goog.update, datetime(2014, 2, 13), -1)
23+
with self.assertRaises(ValueError):
24+
goog.update(datetime(2014, 2, 13), -1)

0 commit comments

Comments
 (0)