From 2e360f7d5772c3059a42db8915530cde952a01c6 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Thu, 2 Apr 2020 16:33:20 +0530 Subject: Show prettified R error messages and fix filter R language available in filter form. Values taken from models. R messages are prettified like python assertion messages. Text up to first colon in the R error message removed, as it is simply a filename or unwanted text. --- yaksh/evaluator_tests/test_r_evaluation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'yaksh/evaluator_tests') diff --git a/yaksh/evaluator_tests/test_r_evaluation.py b/yaksh/evaluator_tests/test_r_evaluation.py index b161dc9..b4b81ae 100644 --- a/yaksh/evaluator_tests/test_r_evaluation.py +++ b/yaksh/evaluator_tests/test_r_evaluation.py @@ -94,7 +94,7 @@ class RAssertionEvaluationTestCase(EvaluatorBaseTest): } ''' ) - err = ['Error: input == output is not TRUE\nExecution halted\n'] + err = 'input == output is not TRUE\nExecution halted\n' kwargs = {'metadata': { 'user_answer': user_answer, 'file_paths': self.file_paths, @@ -109,7 +109,7 @@ class RAssertionEvaluationTestCase(EvaluatorBaseTest): errors = result.get('error') # Then self.assertFalse(result.get('success')) - self.assertEqual(errors, err) + self.assertEqual(errors[0]['message'], err) def test_error_code(self): # Given @@ -135,7 +135,7 @@ class RAssertionEvaluationTestCase(EvaluatorBaseTest): # Then self.assertFalse(result.get("success")) - self.assertIn("object 'a' not found", errors[0]) + self.assertIn("object 'a' not found", errors[0]['message']) def test_empty_function(self): # Given @@ -160,7 +160,8 @@ class RAssertionEvaluationTestCase(EvaluatorBaseTest): # Then self.assertFalse(result.get("success")) - self.assertIn("Error: is.null(obj) == FALSE is not TRUE", errors[0]) + err = errors[0]['message'] + self.assertIn("is.null(obj) == FALSE is not TRUE", err) def test_infinite_loop(self): # Given -- cgit