From 6f6d4ec26cf10d8e2af45b54efaf1b05272c1c02 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Fri, 20 Feb 2015 23:09:26 +0100 Subject: [tests] Minor test/DocTests.py clean up --- test/DocTests.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'test/DocTests.py') diff --git a/test/DocTests.py b/test/DocTests.py index f5746ec4..ac681bc2 100755 --- a/test/DocTests.py +++ b/test/DocTests.py @@ -158,22 +158,13 @@ class DocTests: failed.add(test_id) continue - try: - output = example[self.testout_token][self.testout_token] - except KeyError: - output = None - - try: - input = example[self.testdat_token][self.testdat_token] - except KeyError: - try: - with_input = example[self.testin_token]['opts'][self.testwithdat_token] - input = self.examples[with_input][self.testdat_token][self.testdat_token] - except KeyError: - try: - input = example[self.validate_dat_token][self.validate_dat_token] - except KeyError: - input = None + output = example.get(self.testout_token, {}).get(self.testout_token) + input = example.get(self.testdat_token, {}).get(self.testdat_token) + if not input: + with_input = example.get(self.testin_token, {}).get('opts', {}).get(self.testwithdat_token) + input = self.examples.get(with_input, {}).get(self.testdat_token, {}).get(self.testdat_token) + if not input: + input = example.get(self.validate_dat_token, {}).get(self.validate_dat_token) if command and (output != None or validation): test_file_created = False -- cgit v1.2.3