From 99f6debb6003e21ea91448231c07fdc562fca3d7 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Thu, 20 May 2021 12:31:21 +0100 Subject: [PATCH] Add code comments for tests --- tests/tests/test_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tests/test_utils.py b/tests/tests/test_utils.py index d65f23cd..2d633988 100644 --- a/tests/tests/test_utils.py +++ b/tests/tests/test_utils.py @@ -44,7 +44,8 @@ def test_parent_template_from_variable(self): }, ]) def test_get_template_dirs_app_dirs(self): - template_dirs = ['/'.join(d.replace(os.path.dirname(settings.BASE_DIR), 'dpl').split('/')[-4:-1]) for d in get_template_dirs()] + # get_template_dirs() returns absolute paths. Convert to simpler relative paths so we can write assertions. + template_dirs = ['/'.join(str(d).replace(os.path.dirname(settings.BASE_DIR), 'dpl').split('/')[-4:-1]) for d in get_template_dirs()] self.assertListEqual(template_dirs, [ 'django/contrib/auth', 'dpl/pattern_library', @@ -65,7 +66,8 @@ def test_get_template_dirs_app_dirs(self): }, ]) def test_get_template_dirs_list_dirs(self): - template_dirs = ['/'.join(d.replace(os.path.dirname(settings.BASE_DIR), 'dpl').split('/')[-4:-1]) for d in get_template_dirs()] + # get_template_dirs() returns absolute paths. Convert to simpler relative paths so we can write assertions. + template_dirs = ['/'.join(str(d).replace(os.path.dirname(settings.BASE_DIR), 'dpl').split('/')[-4:-1]) for d in get_template_dirs()] self.assertListEqual(template_dirs, [ 'dpl/tests/test_one', 'dpl/tests/test_two',