diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-09-25 18:54:47 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-09-25 18:54:47 +0300 |
commit | 9f8dfa9d9b3cf3315bfab27274f4b11715d952c4 (patch) | |
tree | dd6af00d475172d42a61df72691a4b19240e4462 | |
parent | 9b1555dc20de4ac7d4148fba78ba08aa13860668 (diff) | |
download | server-yarns-9f8dfa9d9b3cf3315bfab27274f4b11715d952c4.tar.gz |
Add stump for get_variable
-rw-r--r-- | yarnhelper.py | 3 | ||||
-rw-r--r-- | yarnhelper_tests.py | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/yarnhelper.py b/yarnhelper.py index 4501eab..b5c45d0 100644 --- a/yarnhelper.py +++ b/yarnhelper.py @@ -35,6 +35,9 @@ class YarnHelper(object): self._next_match += 1 return self._env[name] + def get_variable(self, name): + raise Error('no variable {}'.format(name)) + class Error(Exception): diff --git a/yarnhelper_tests.py b/yarnhelper_tests.py index a61102f..bdc0cd9 100644 --- a/yarnhelper_tests.py +++ b/yarnhelper_tests.py @@ -53,3 +53,12 @@ class GetNextMatchTests(unittest.TestCase): self.assertEqual(h.get_next_match(), 'first') with self.assertRaises(yarnhelper.Error): h.get_next_match() + + +class PersistentVariableTests(unittest.TestCase): + + def test_raises_error_if_no_such_variable(self): + h = yarnhelper.YarnHelper() + with self.assertRaises(yarnhelper.Error): + h.get_variable('FOO') + |