#34823: _assert_template_used fails with anonymous templates
---------------------------------------------+------------------------
Reporter: Arian | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
When template_names includes at least one None type the string join will
fail.
This occurs when a rendered template does not define a name.
```
Traceback (most recent call last):
File "/home/.../admin-
frontend/admin_frontend/admin_cash/tests/test_views.py", line 19, in
test_get_context_data
with self.assertTemplateUsed('admin_cash/bill_validator_logs.html'):
File "/home/../3.10/lib/python3.10/site-
packages/django/test/testcases.py", line 146, in __exit__
self.test()
File "/home/../3.10/lib/python3.10/site-
packages/django/test/testcases.py", line 131, in test
self.test_case._assert_template_used(
File "/home/../3.10/lib/python3.10/site-
packages/django/test/testcases.py", line 828, in _assert_template_used
% (template_name, ", ".join(template_names)),
TypeError: sequence item 0: expected str instance, NoneType found
```
--
Ticket URL: <https://code.djangoproject.com/ticket/34823>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018a771f8813-8dfca03c-d7ae-40fb-89e2-658ede5fbcf3-000000%40eu-central-1.amazonses.com.