1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[1.11.x] Fixed #28355 -- Fixed widget rendering of non-ASCII date/time formats on Python 2.

This commit is contained in:
Tim Graham
2017-07-03 10:16:48 -04:00
parent 72026fff39
commit 81febf4def
3 changed files with 17 additions and 2 deletions

View File

@@ -1,4 +1,9 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import sys
from datetime import time
from unittest import skipIf
from django.forms import TimeInput
from django.test import override_settings
@@ -43,6 +48,12 @@ class TimeInputTest(WidgetTest):
widget = TimeInput(format='%H:%M', attrs={'type': 'time'})
self.check_html(widget, 'time', t, html='<input type="time" name="time" value="12:51" />')
# Test fails on Windows due to http://bugs.python.org/issue8304#msg222667
@skipIf(sys.platform.startswith('win'), 'Fails with UnicodeEncodeError error on Windows.')
def test_non_ascii_format(self):
widget = TimeInput(format='τ-%H:%M')
self.check_html(widget, 'time', time(10, 10), '<input type="text" name="time" value="\u03c4-10:10" />')
@override_settings(USE_L10N=True)
@translation.override('de-at')
def test_l10n(self):