-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of non-string values for 'override_tag's 'default_ht…
…ml' argument (#224)
- Loading branch information
Showing
5 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/templates/patterns/atoms/tags_test_atom/invalid_tags_test_atom.html.fail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% load test_tags_invalid %} | ||
|
||
MARMA{% default_html_tag_invalid empty_string %}LADE01 | ||
MARMA{% default_html_tag_invalid none %}LADE02 | ||
MARMA{% default_html_tag_invalid dict %}LADE03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django import template | ||
|
||
from pattern_library.monkey_utils import override_tag | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag() | ||
def default_html_tag_invalid(arg=None): | ||
"Just raise an exception, never do anything" | ||
raise Exception("default_tag raised an exception") | ||
|
||
|
||
# Test overriding tag with a default_html that's not valid in Django >= 4.0 | ||
override_tag(register, "default_html_tag_invalid", default_html=[1, 2, 3]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters