summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-09-25 18:52:17 +0300
committerLars Wirzenius <liw@liw.fi>2016-09-25 18:52:17 +0300
commit9b1555dc20de4ac7d4148fba78ba08aa13860668 (patch)
tree86f7f5e76e8ca56e08b0b7eae3be29bef933b4ed
parent05b15134b0eefbd5c8f363665ef4d61d1b4136fc (diff)
downloadserver-yarns-9b1555dc20de4ac7d4148fba78ba08aa13860668.tar.gz
Check that error is raises if no more matches
-rw-r--r--yarnhelper_tests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/yarnhelper_tests.py b/yarnhelper_tests.py
index d13abb8..a61102f 100644
--- a/yarnhelper_tests.py
+++ b/yarnhelper_tests.py
@@ -31,7 +31,9 @@ class GetNextMatchTests(unittest.TestCase):
def test_returns_first_match_if_there(self):
h = yarnhelper.YarnHelper()
- h.set_environment({'MATCH_1': 'first'})
+ h.set_environment({
+ 'MATCH_1': 'first',
+ })
self.assertEqual(h.get_next_match(), 'first')
def test_returns_second_match_if_there(self):
@@ -42,3 +44,12 @@ class GetNextMatchTests(unittest.TestCase):
})
self.assertEqual(h.get_next_match(), 'first')
self.assertEqual(h.get_next_match(), 'second')
+
+ def test_raises_error_if_no_more_matches(self):
+ h = yarnhelper.YarnHelper()
+ h.set_environment({
+ 'MATCH_1': 'first',
+ })
+ self.assertEqual(h.get_next_match(), 'first')
+ with self.assertRaises(yarnhelper.Error):
+ h.get_next_match()