Chromium Code Reviews| Index: recipe_engine/unittests/recipe_test_api_test.py |
| diff --git a/recipe_engine/unittests/recipe_test_api_test.py b/recipe_engine/unittests/recipe_test_api_test.py |
| index c43c2a8e24b77c1fda9adbba3c04c351388bc166..3dc7c5bdb06d5d61cc5645086c1d194f803b48b7 100755 |
| --- a/recipe_engine/unittests/recipe_test_api_test.py |
| +++ b/recipe_engine/unittests/recipe_test_api_test.py |
| @@ -17,7 +17,7 @@ class EXC(Exception): |
| class TestExpectedException(unittest.TestCase): |
| def testRecognizeException(self): |
| """An expected exception is correctly recognized.""" |
| - test_data = recipe_test_api.TestData() |
| + test_data = recipe_test_api.TestData("test") |
|
Paweł Hajdan Jr.
2017/02/21 09:53:31
nit: Single quotes ' instead of double " (applies
|
| test_data.expect_exception(EXC.__name__) |
| self.assertFalse(test_data.consumed) |
| @@ -31,7 +31,7 @@ class TestExpectedException(unittest.TestCase): |
| def testNewException(self): |
| """An unexpected exception results in being told to re-raise .""" |
| - test_data = recipe_test_api.TestData() |
| + test_data = recipe_test_api.TestData("test") |
| self.assertTrue(test_data.consumed) |
| with test_data.should_raise_exception(EXC()) as should_raise: |
| @@ -41,10 +41,18 @@ class TestExpectedException(unittest.TestCase): |
| def testDisabledTestData(self): |
| """Disabled test data correctly re-raises all exceptions.""" |
| - test_data = recipe_test_api.TestData() |
| + test_data = recipe_test_api.TestData("test") |
| with test_data.should_raise_exception(EXC()) as should_raise: |
| self.assertTrue(should_raise) |
| + def test_invalid_test_names(self): |
| + for bad in ('bad name', 'a\////', 'b\\\\', 'c(*#&($'): |
| + self.assertFalse(recipe_test_api.is_valid_test_name(bad)) |
| + |
| + def test_valid_test_names(self): |
| + for good in ('good', 'with_underscores_now', 'and_numbers_1'): |
| + self.assertTrue(recipe_test_api.is_valid_test_name(good)) |
| + |
| if __name__ == '__main__': |
| unittest.main() |