diff options
author | Rex Lee <limingjiang@huawei.com> | 2018-08-07 07:57:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-08-07 07:57:21 +0000 |
commit | 60e326463ae06038facf79f14e29901e9596e0dc (patch) | |
tree | fe544ca7ab4845630ef43e536b11109e959a3818 | |
parent | a562d505bf1549b41e93ecae4d8461f31851aa20 (diff) | |
parent | 00af29d52e4e13f7a58c0b6bddf4ef809e2f72e2 (diff) |
Merge "Separate out test_parse_to_value_exception()"
-rw-r--r-- | yardstick/tests/unit/common/test_template_format.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/yardstick/tests/unit/common/test_template_format.py b/yardstick/tests/unit/common/test_template_format.py index 56253efbc..6e4827e16 100644 --- a/yardstick/tests/unit/common/test_template_format.py +++ b/yardstick/tests/unit/common/test_template_format.py @@ -22,16 +22,21 @@ from yardstick.common import template_format class TemplateFormatTestCase(unittest.TestCase): - def test_parse_to_value_exception(self): + def test_parse_scanner(self): - # TODO(elfoley): Don't hide the error that occurs in - # template_format.parse - # TODO(elfoley): Separate these tests; one per error type with mock.patch.object(yaml, 'load') as yaml_loader: yaml_loader.side_effect = yaml.scanner.ScannerError() self.assertRaises(ValueError, template_format.parse, 'FOOBAR') + + def test_parse_parser(self): + + with mock.patch.object(yaml, 'load') as yaml_loader: yaml_loader.side_effect = yaml.parser.ParserError() self.assertRaises(ValueError, template_format.parse, 'FOOBAR') + + def test_parse_reader(self): + + with mock.patch.object(yaml, 'load') as yaml_loader: yaml_loader.side_effect = \ yaml.reader.ReaderError('', '', '', '', '') self.assertRaises(ValueError, template_format.parse, 'FOOBAR') |