From b55f97fd37b400f8d4953bb06487e962aae26487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=B6ffner?= <info@sebastian-hoeffner.de> Date: Wed, 17 Oct 2018 22:35:36 +0200 Subject: [PATCH] Updated ccgparser test to catch file readings errors per subTest and not for all files at once. --- tests/test_ccgparser.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_ccgparser.py b/tests/test_ccgparser.py index 18d495d..82a4fd4 100644 --- a/tests/test_ccgparser.py +++ b/tests/test_ccgparser.py @@ -13,18 +13,18 @@ import ccgparser # noqa class CCGtoJSONTestCase(unittest.TestCase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.maxDiff = None def test_ccg_to_json(self): """ Provides some example OpenCCG outputs and the expected JSON parses. """ - self.test_files = (Path(os.path.dirname(__file__)) - / 'test_files' - / 'ccg_to_json').glob('*') - - for name, test_case in [(tf.name, json.loads(tf.read_text())) - for tf in self.test_files]: - with self.subTest(test_case=name): + test_files = (Path(os.path.dirname(__file__)) / 'test_files' / 'ccg_to_json').glob('*') + for tf in test_files: + with self.subTest(test_case=tf.name): + test_case = json.loads(tf.read_text()) ccg = test_case['ccg'] expected = test_case['json'] -- GitLab