mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #33476 -- Reformatted code with Black.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f68fa8b45d
commit
9c19aff7c7
@@ -8,85 +8,130 @@ class NullBooleanSelectTest(WidgetTest):
|
||||
widget = NullBooleanSelect()
|
||||
|
||||
def test_render_true(self):
|
||||
self.check_html(self.widget, 'is_cool', True, html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
True,
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true" selected>Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_false(self):
|
||||
self.check_html(self.widget, 'is_cool', False, html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
False,
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false" selected>No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_none(self):
|
||||
self.check_html(self.widget, 'is_cool', None, html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
None,
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown" selected>Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_unknown(self):
|
||||
self.check_html(self.widget, 'is_cool', 'unknown', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"unknown",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown" selected>Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_true(self):
|
||||
self.check_html(self.widget, 'is_cool', 'true', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"true",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true" selected>Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_false(self):
|
||||
self.check_html(self.widget, 'is_cool', 'false', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"false",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false" selected>No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_1(self):
|
||||
self.check_html(self.widget, 'is_cool', '1', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"1",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown" selected>Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_2(self):
|
||||
self.check_html(self.widget, 'is_cool', '2', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"2",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true" selected>Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_render_value_3(self):
|
||||
self.check_html(self.widget, 'is_cool', '3', html=(
|
||||
"""<select name="is_cool">
|
||||
self.check_html(
|
||||
self.widget,
|
||||
"is_cool",
|
||||
"3",
|
||||
html=(
|
||||
"""<select name="is_cool">
|
||||
<option value="unknown">Unknown</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false" selected>No</option>
|
||||
</select>"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
def test_l10n(self):
|
||||
"""
|
||||
@@ -94,13 +139,18 @@ class NullBooleanSelectTest(WidgetTest):
|
||||
"""
|
||||
widget = NullBooleanSelect()
|
||||
|
||||
with translation.override('de-at'):
|
||||
self.check_html(widget, 'id_bool', True, html=(
|
||||
"""
|
||||
with translation.override("de-at"):
|
||||
self.check_html(
|
||||
widget,
|
||||
"id_bool",
|
||||
True,
|
||||
html=(
|
||||
"""
|
||||
<select name="id_bool">
|
||||
<option value="unknown">Unbekannt</option>
|
||||
<option value="true" selected>Ja</option>
|
||||
<option value="false">Nein</option>
|
||||
</select>
|
||||
"""
|
||||
))
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user