Skip to content

Commit

Permalink
#1527 Set the sets to be sets and hope it doesn't upset everything.
Browse files Browse the repository at this point in the history
  • Loading branch information
edSynapse committed Jan 3, 2024
1 parent 725c3da commit ac3cf5b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_base_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,64 +79,64 @@ def test_include_placeholder_in_missing_data_if_placeholder_is_conditional(perso
(
"the quick brown fox",
"jumps",
[]
set()
),
(
"the quick ((colour)) fox",
"jumps",
["colour"]
{"colour"}
),
(
"the quick ((colour)) ((animal))",
"jumps",
["colour", "animal"]
{"colour", "animal"}
),
(
"((colour)) ((animal)) ((colour)) ((animal))",
"jumps",
["colour", "animal"]
{"colour", "animal"}
),
(
"the quick brown fox",
"((colour))",
["colour"]
{"colour"}
),
(
"the quick ((colour)) ",
"((animal))",
["animal", "colour"]
{"animal", "colour"}
),
(
"((colour)) ((animal)) ",
"((colour)) ((animal))",
["colour", "animal"]
{"colour", "animal"}
),
(
"Dear ((name)), ((warning?? This is a warning))",
"",
["name", "warning"]
{"name", "warning"}
),
(
# Placeholder names are limited to alphanumeric characters, spaces and dashes
"((warning? one question mark))",
"",
[]
set()
),
(
"Dear ((name)), ((warning?? This is a warning {}))",
"",
["name", "warning"]
{"name", "warning"}
),
(
"A conditional url: ((has_url?? [some link](http://test.me) ))",
"",
["has_url"]
{"has_url"}
),
]
)
def test_extracting_placeholders(template_content, template_subject, expected):
got = WithSubjectTemplate({"content": template_content, 'subject': template_subject}).placeholders
assert got == expected
assert WithSubjectTemplate({"content": template_content, 'subject': template_subject}).placeholders == expected


@pytest.mark.parametrize('template_cls', [SMSMessageTemplate, SMSPreviewTemplate])
Expand Down

0 comments on commit ac3cf5b

Please sign in to comment.