From d812859a8ffc3ea450e8cdbfb945f0cb9f04de5a Mon Sep 17 00:00:00 2001 From: Muhammad Farhan Khan Date: Wed, 22 May 2024 11:39:49 +0500 Subject: [PATCH] fix: -- --- xblock/test/utils/test_resources.py | 22 +++++++++++----------- xblock/utils/studio_editable.py | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xblock/test/utils/test_resources.py b/xblock/test/utils/test_resources.py index d0b8a35a5..1ddd59ede 100644 --- a/xblock/test/utils/test_resources.py +++ b/xblock/test/utils/test_resources.py @@ -154,7 +154,7 @@ class TestResourceLoader(unittest.TestCase): """ def test_load_unicode(self): - s = ResourceLoader(__package__).load_unicode("data/simple_django_template.txt") + s = ResourceLoader(__name__).load_unicode("data/simple_django_template.txt") self.assertEqual(s, expected_string) def test_load_unicode_from_another_module(self): @@ -162,12 +162,12 @@ def test_load_unicode_from_another_module(self): self.assertEqual(s, expected_string) def test_render_django_template(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_django_template("data/simple_django_template.txt", example_context) self.assertEqual(s, expected_filled_template) def test_render_django_template_translated(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_django_template("data/trans_django_template.txt", context=example_context, i18n_service=MockI18nService()) @@ -179,31 +179,31 @@ def test_render_django_template_translated(self): def test_render_django_template_localized(self): # Test that default template tags like l10n are loaded - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_django_template("data/l10n_django_template.txt", context=example_context, i18n_service=MockI18nService()) self.assertEqual(s, expected_localized_template) def test_render_mako_template(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_mako_template("data/simple_mako_template.txt", example_context) self.assertEqual(s, expected_filled_template) @patch('warnings.warn', DEFAULT) def test_render_template_deprecated(self, mock_warn): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_template("data/simple_django_template.txt", example_context) self.assertTrue(mock_warn.called) self.assertEqual(s, expected_filled_template) def test_render_js_template(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_js_template("data/simple_django_template.txt", example_id, example_context) self.assertEqual(s, expected_filled_js_template) def test_render_js_template_translated(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_js_template("data/trans_django_template.txt", example_id, context=example_context, @@ -216,7 +216,7 @@ def test_render_js_template_translated(self): def test_render_js_template_localized(self): # Test that default template tags like l10n are loaded - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) s = loader.render_js_template("data/l10n_django_template.txt", example_id, context=example_context, @@ -224,11 +224,11 @@ def test_render_js_template_localized(self): self.assertEqual(s, expected_filled_localized_js_template) def test_load_scenarios(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) scenarios = loader.load_scenarios_from_path("data") self.assertEqual(scenarios, expected_scenarios) def test_load_scenarios_with_identifiers(self): - loader = ResourceLoader(__package__) + loader = ResourceLoader(__name__) scenarios = loader.load_scenarios_from_path("data", include_identifier=True) self.assertEqual(scenarios, expected_scenarios_with_identifiers) diff --git a/xblock/utils/studio_editable.py b/xblock/utils/studio_editable.py index 8a12400eb..b705854cb 100644 --- a/xblock/utils/studio_editable.py +++ b/xblock/utils/studio_editable.py @@ -21,7 +21,7 @@ # Globals ########################################################### log = logging.getLogger(__name__) -loader = ResourceLoader(__package__) +loader = ResourceLoader(__name__) # Classes ###########################################################