From c4bf96e19646a71640441766d40b3f7435d23295 Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Sun, 9 May 2021 20:15:52 +0200 Subject: [PATCH 01/10] Update test_framework.py --- codewars_test/test_framework.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codewars_test/test_framework.py b/codewars_test/test_framework.py index 50b9f85..cbe0993 100644 --- a/codewars_test/test_framework.py +++ b/codewars_test/test_framework.py @@ -51,8 +51,8 @@ def expect_error(message, function, exception=Exception): function() except exception: passed = True - except Exception: - pass + except Exception as e: + message = "{}: {} should be {}".format(message or "Unexpected exception", repr(e), repr(exception)) expect(passed, message) @@ -62,7 +62,7 @@ def expect_no_error(message, function, exception=BaseException): except exception as e: fail("{}: {}".format(message or "Unexpected exception", repr(e))) return - except Exception: + except: pass pass_() From aa5b293de89ada2e5c461db2da756ffdba866fae Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 10 May 2021 19:00:19 +0200 Subject: [PATCH 02/10] Update expect_error_sample.expected.txt --- .../fixtures/expect_error_sample.expected.txt | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/fixtures/expect_error_sample.expected.txt b/tests/fixtures/expect_error_sample.expected.txt index b2c7f56..3ca9455 100644 --- a/tests/fixtures/expect_error_sample.expected.txt +++ b/tests/fixtures/expect_error_sample.expected.txt @@ -17,7 +17,7 @@ f0 did not raise OSError -0.03 +0.3 f1 raises Exception @@ -25,15 +25,16 @@ Test Passed -f1 did not raise ArithmeticError +f1 did not raise ArithmeticError: Exception() should be -f1 did not raise ZeroDivisionError +f1 did not raise ZeroDivisionError: Exception() should be + -f1 did not raise LookupError +f1 did not raise LookupError: Exception() should be -f1 did not raise KeyError +f1 did not raise KeyError: Exception() should be -f1 did not raise OSError +f1 did not raise OSError: Exception() should be 0.02 @@ -47,11 +48,11 @@ Test Passed -f2 did not raise LookupError +f2 did not raise LookupError: ZeroDivisionError('integer division or modulo by zero',) should be -f2 did not raise KeyError +f2 did not raise KeyError: ZeroDivisionError('integer division or modulo by zero',) should be -f2 did not raise OSError +f2 did not raise OSError: ZeroDivisionError('integer division or modulo by zero',) should be 0.02 @@ -61,16 +62,16 @@ Test Passed -f3 did not raise ArithmeticError +f3 did not raise ArithmeticError: KeyError(1,) should be -f3 did not raise ZeroDivisionError +f3 did not raise ZeroDivisionError: KeyError(1,) should be Test Passed Test Passed -f3 did not raise OSError +f3 did not raise OSError: KeyError(1,) should be 0.02 -0.11 +0.11 \ No newline at end of file From 39313b93e5b02a4d69c667944a608c0d1e9f5d92 Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 10 May 2021 19:02:44 +0200 Subject: [PATCH 03/10] Update expect_error_sample.expected.txt --- tests/fixtures/expect_error_sample.expected.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/expect_error_sample.expected.txt b/tests/fixtures/expect_error_sample.expected.txt index 3ca9455..1bacb79 100644 --- a/tests/fixtures/expect_error_sample.expected.txt +++ b/tests/fixtures/expect_error_sample.expected.txt @@ -17,7 +17,7 @@ f0 did not raise OSError -0.3 +0.03 f1 raises Exception From ea1fba751a563bdf0d411e5cebc44daa2bd51b4c Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 10 May 2021 19:12:17 +0200 Subject: [PATCH 04/10] Update expect_error_sample.expected.txt --- tests/fixtures/expect_error_sample.expected.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/fixtures/expect_error_sample.expected.txt b/tests/fixtures/expect_error_sample.expected.txt index 1bacb79..6b93fa8 100644 --- a/tests/fixtures/expect_error_sample.expected.txt +++ b/tests/fixtures/expect_error_sample.expected.txt @@ -27,8 +27,7 @@ f1 did not raise ArithmeticError: Exception() should be -f1 did not raise ZeroDivisionError: Exception() should be - +f1 did not raise ZeroDivisionError: Exception() should be f1 did not raise LookupError: Exception() should be From f987a76d4327bd1591ea43f69bad847a642c718b Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 17 May 2021 23:04:45 +0200 Subject: [PATCH 05/10] Update test_outputs.py --- tests/test_outputs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index bfe8396..e1c1512 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -23,6 +23,9 @@ def test(self): expected = re.sub( r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", r.read() ) + expected = re.sub( + r"Error\(([^)]*?)\)", r"Error\\(\1\\)", expected) + self.assertRegex(result.stdout.decode("utf-8"), expected) return test From ee56e1afb459e38b4da0f16233e1eda34b944714 Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 17 May 2021 23:10:55 +0200 Subject: [PATCH 06/10] Update test_outputs.py --- tests/test_outputs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index e1c1512..78d28e7 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -24,8 +24,8 @@ def test(self): r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", r.read() ) expected = re.sub( - r"Error\(([^)]*?)\)", r"Error\\(\1\\)", expected) - + r"(Error|Exception)\(([^)]*?)\)", r"\1\\(\2\\)", expected) + self.assertRegex(result.stdout.decode("utf-8"), expected) return test From c882e74a5913568362930f8b56eaa357637fa20a Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 17 May 2021 23:23:46 +0200 Subject: [PATCH 07/10] Update expect_error_sample.expected.txt --- tests/fixtures/expect_error_sample.expected.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fixtures/expect_error_sample.expected.txt b/tests/fixtures/expect_error_sample.expected.txt index 6b93fa8..b0cb56d 100644 --- a/tests/fixtures/expect_error_sample.expected.txt +++ b/tests/fixtures/expect_error_sample.expected.txt @@ -47,11 +47,11 @@ Test Passed -f2 did not raise LookupError: ZeroDivisionError('integer division or modulo by zero',) should be +f2 did not raise LookupError: ZeroDivisionError('integer division or modulo by zero') should be -f2 did not raise KeyError: ZeroDivisionError('integer division or modulo by zero',) should be +f2 did not raise KeyError: ZeroDivisionError('integer division or modulo by zero') should be -f2 did not raise OSError: ZeroDivisionError('integer division or modulo by zero',) should be +f2 did not raise OSError: ZeroDivisionError('integer division or modulo by zero') should be 0.02 @@ -61,15 +61,15 @@ Test Passed -f3 did not raise ArithmeticError: KeyError(1,) should be +f3 did not raise ArithmeticError: KeyError(1) should be -f3 did not raise ZeroDivisionError: KeyError(1,) should be +f3 did not raise ZeroDivisionError: KeyError(1) should be Test Passed Test Passed -f3 did not raise OSError: KeyError(1,) should be +f3 did not raise OSError: KeyError(1) should be 0.02 From 73238391bc913c1a402ed7dd48b8e01c0dcef510 Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 17 May 2021 23:29:48 +0200 Subject: [PATCH 08/10] Update test_outputs.py --- tests/test_outputs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index 78d28e7..acfec76 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -20,11 +20,10 @@ def test(self): ) with open(expected_file, "r", encoding="utf-8") as r: # Allow duration to change + expected = re.sub( r"[()]", r"\\\1", r.read() ) expected = re.sub( - r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", r.read() + r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", expected ) - expected = re.sub( - r"(Error|Exception)\(([^)]*?)\)", r"\1\\(\2\\)", expected) self.assertRegex(result.stdout.decode("utf-8"), expected) From b51ce7c4838559a09eb02442c40c6ea0ecaac5aa Mon Sep 17 00:00:00 2001 From: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com> Date: Mon, 17 May 2021 23:31:17 +0200 Subject: [PATCH 09/10] Update test_outputs.py --- tests/test_outputs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index acfec76..05c01b7 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -20,7 +20,7 @@ def test(self): ) with open(expected_file, "r", encoding="utf-8") as r: # Allow duration to change - expected = re.sub( r"[()]", r"\\\1", r.read() ) + expected = re.sub( r"([()])", r"\\\1", r.read() ) expected = re.sub( r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", expected ) From 8393bfca718c0db74a22778537aab8c2b4587c04 Mon Sep 17 00:00:00 2001 From: kazk Date: Mon, 17 May 2021 16:31:12 -0700 Subject: [PATCH 10/10] Remove extra spaces --- tests/test_outputs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index 05c01b7..e35f8a2 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -20,7 +20,7 @@ def test(self): ) with open(expected_file, "r", encoding="utf-8") as r: # Allow duration to change - expected = re.sub( r"([()])", r"\\\1", r.read() ) + expected = re.sub(r"([()])", r"\\\1", r.read()) expected = re.sub( r"(?<=)\d+(?:\.\d+)?", r"\\d+(?:\\.\\d+)?", expected )