Skip to content

Commit

Permalink
Add code comments for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudcolas committed May 20, 2021
1 parent 815759f commit 8d93a3a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ 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).split('/')[-4:-1]) for d in get_template_dirs()]
self.assertListEqual(template_dirs, [
'django/contrib/auth',
'dpl/pattern_library',
'dpl/tests',
'django-pattern-library/pattern_library',
'django-pattern-library/tests',
])

@override_settings(TEMPLATES=[
Expand All @@ -65,11 +66,12 @@ 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).split('/')[-4:-1]) for d in get_template_dirs()]
self.assertListEqual(template_dirs, [
'dpl/tests/test_one',
'dpl/tests/test_two',
'django-pattern-library/tests/test_one',
'django-pattern-library/tests/test_two',
'django/contrib/auth',
'dpl/pattern_library',
'dpl/tests',
'django-pattern-library/pattern_library',
'django-pattern-library/tests',
])

0 comments on commit 8d93a3a

Please sign in to comment.