From d8b7a2e1fe90440cf3f20f263e80c951a14baf1e Mon Sep 17 00:00:00 2001 From: jinder1s Date: Mon, 7 Oct 2019 10:26:39 -0400 Subject: [PATCH] quality fixes --- openedx/core/djangolib/tests/test_js_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangolib/tests/test_js_utils.py b/openedx/core/djangolib/tests/test_js_utils.py index 92e5b766f4..e5d78c674a 100644 --- a/openedx/core/djangolib/tests/test_js_utils.py +++ b/openedx/core/djangolib/tests/test_js_utils.py @@ -14,6 +14,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str import six # pylint: disable=ungrouped-imports import re + class TestJSUtils(TestCase): """ Test JS utils @@ -145,7 +146,7 @@ class TestJSUtils(TestCase): self.assertIn(""test_tuple": [1, 2, 3]", out) self.assertIn(""test_number": 3.5", out) self.assertIn(""test_bool": false", out) - self.assertIn(""test_string": "test-=&\\\\;'\\"<>\\u2603"",out) + self.assertIn(""test_string": "test-=&\\\\;'\\"<>\\u2603"", out) self.assertIn(u"data-test-string='test-=&\\;'"<>☃'", out) self.assertIn("data-test-tuple='[1, 2, 3]'", out) self.assertIn("data-test-number='3.5'", out) @@ -153,13 +154,13 @@ class TestJSUtils(TestCase): expected_string_for_js_in_dict = r'''test-=\u0026\\;'\"\u003c\u003e\u2603''' self._validate_expectation_of_string_for_js(test_dict['test_string'], expected_string_for_js_in_dict) - location_of_dict_in_out = output=re.search("var test_dict.*}",out) - var_dict_in_out = out[output.span()[0]:output.span()[1]] + location_of_dict_in_out = re.search("var test_dict.*}", out) + var_dict_in_out = out[location_of_dict_in_out.span()[0]:location_of_dict_in_out.span()[1]] self.assertIn('"test_number": 3.5', var_dict_in_out) self.assertIn('"test_string": "test-=\\u0026\\\\;\'\\"\\u003c\\u003e\\u2603"', var_dict_in_out) self.assertIn('"test_tuple": [1, 2, 3]', var_dict_in_out) self.assertIn('"test_bool": false', var_dict_in_out) - + expected_string_for_js = u"test\\u002D\\u003D\\u0026\\u005C\\u003B\\u0027\\u0022\\u003C\\u003E☃" self._validate_expectation_of_string_for_js(test_dict['test_string'], expected_string_for_js) self.assertIn("var test_string = '" + expected_string_for_js + "'", out)