From d11b4c7185fc707fe5a46157fd6a39488a658d08 Mon Sep 17 00:00:00 2001 From: Vasileios Vryniotis Date: Wed, 14 Oct 2020 16:14:51 +0100 Subject: [PATCH 1/3] Removing unnecessary variable. --- test/common_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/common_utils.py b/test/common_utils.py index 920e999863f..6910a724ddb 100644 --- a/test/common_utils.py +++ b/test/common_utils.py @@ -150,7 +150,6 @@ def accept_output(update_type): "python {} {} --accept").format(munged_id, subname_output, output, __main__.__file__, munged_id)) if ACCEPT: - equal = False try: equal = self.assertEqual(output, expected, prec=prec) except Exception: From 197f58ea42a9cc9bf4d6ad7560b2cd0f6d07d39d Mon Sep 17 00:00:00 2001 From: Vasileios Vryniotis Date: Wed, 14 Oct 2020 16:43:02 +0100 Subject: [PATCH 2/3] Refactoring common_utils.py to remove unused vars. --- test/common_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/common_utils.py b/test/common_utils.py index 6910a724ddb..d75b1f4b938 100644 --- a/test/common_utils.py +++ b/test/common_utils.py @@ -151,10 +151,8 @@ def accept_output(update_type): if ACCEPT: try: - equal = self.assertEqual(output, expected, prec=prec) + self.assertEqual(output, expected, prec=prec) except Exception: - equal = False - if not equal: return accept_output("updated output") else: self.assertEqual(output, expected, prec=prec) From a52bb202d1f0f3c6f2e782c7a3fcf8544045df7c Mon Sep 17 00:00:00 2001 From: Vasileios Vryniotis Date: Wed, 14 Oct 2020 17:41:48 +0100 Subject: [PATCH 3/3] Removing unused value and changing use of accept_output. --- test/common_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/common_utils.py b/test/common_utils.py index d75b1f4b938..5368018e971 100644 --- a/test/common_utils.py +++ b/test/common_utils.py @@ -127,7 +127,6 @@ def remove_prefix_suffix(text, prefix, suffix): expected_file += "_" + subname subname_output = " ({})".format(subname) expected_file += "_expect.pkl" - expected = None def accept_output(update_type): print("Accepting {} for {}{}:\n\n{}".format(update_type, munged_id, subname_output, output)) @@ -142,7 +141,8 @@ def accept_output(update_type): if e.errno != errno.ENOENT: raise elif ACCEPT: - return accept_output("output") + accept_output("output") + return else: raise RuntimeError( ("I got this output for {}{}:\n\n{}\n\n" @@ -153,7 +153,7 @@ def accept_output(update_type): try: self.assertEqual(output, expected, prec=prec) except Exception: - return accept_output("updated output") + accept_output("updated output") else: self.assertEqual(output, expected, prec=prec)