@@ -13,46 +13,44 @@ def test_basics():
1313 delta = timedelta (days = 6 )
1414
1515 with app .test_request_context ():
16- assert babel .format_datetime (d ) == ' Apr 12, 2010, 1:46:00\u202f PM'
17- assert babel .format_date (d ) == ' Apr 12, 2010'
18- assert babel .format_time (d ) == ' 1:46:00\u202f PM'
19- assert babel .format_timedelta (delta ) == ' 1 week'
20- assert babel .format_timedelta (delta , threshold = 1 ) == ' 6 days'
16+ assert babel .format_datetime (d ) == " Apr 12, 2010, 1:46:00\u202f PM"
17+ assert babel .format_date (d ) == " Apr 12, 2010"
18+ assert babel .format_time (d ) == " 1:46:00\u202f PM"
19+ assert babel .format_timedelta (delta ) == " 1 week"
20+ assert babel .format_timedelta (delta , threshold = 1 ) == " 6 days"
2121
2222 with app .test_request_context ():
23- get_babel (app ).default_timezone = ' Europe/Vienna'
24- assert babel .format_datetime (d ) == ' Apr 12, 2010, 3:46:00\u202f PM'
25- assert babel .format_date (d ) == ' Apr 12, 2010'
26- assert babel .format_time (d ) == ' 3:46:00\u202f PM'
23+ get_babel (app ).default_timezone = " Europe/Vienna"
24+ assert babel .format_datetime (d ) == " Apr 12, 2010, 3:46:00\u202f PM"
25+ assert babel .format_date (d ) == " Apr 12, 2010"
26+ assert babel .format_time (d ) == " 3:46:00\u202f PM"
2727
2828 with app .test_request_context ():
29- get_babel (app ).default_locale = 'de_DE'
30- assert babel .format_datetime (d , 'long' ) == \
31- '12. April 2010, 15:46:00 MESZ'
29+ get_babel (app ).default_locale = "de_DE"
30+ assert babel .format_datetime (d , "long" ) == "12. April 2010, 15:46:00 MESZ"
3231
3332
3433def test_custom_formats ():
3534 app = flask .Flask (__name__ )
3635 app .config .update (
37- BABEL_DEFAULT_LOCALE = 'en_US' ,
38- BABEL_DEFAULT_TIMEZONE = 'Pacific/Johnston'
36+ BABEL_DEFAULT_LOCALE = "en_US" , BABEL_DEFAULT_TIMEZONE = "Pacific/Johnston"
3937 )
4038 b = babel .Babel (app )
41- b .date_formats [' datetime' ] = ' long'
42- b .date_formats [' datetime.long' ] = ' MMMM d, yyyy h:mm:ss a'
39+ b .date_formats [" datetime" ] = " long"
40+ b .date_formats [" datetime.long" ] = " MMMM d, yyyy h:mm:ss a"
4341 d = datetime (2010 , 4 , 12 , 13 , 46 )
4442
4543 with app .test_request_context ():
46- assert babel .format_datetime (d ) == ' April 12, 2010 3:46:00 AM'
44+ assert babel .format_datetime (d ) == " April 12, 2010 3:46:00 AM"
4745
4846
4947def test_custom_locale_selector ():
5048 app = flask .Flask (__name__ )
5149 b = babel .Babel (app )
5250 d = datetime (2010 , 4 , 12 , 13 , 46 )
5351
54- the_timezone = ' UTC'
55- the_locale = ' en_US'
52+ the_timezone = " UTC"
53+ the_locale = " en_US"
5654
5755 def select_locale ():
5856 return the_locale
@@ -64,21 +62,21 @@ def select_timezone():
6462 get_babel (app ).timezone_selector = select_timezone
6563
6664 with app .test_request_context ():
67- assert babel .format_datetime (d ) == ' Apr 12, 2010, 1:46:00\u202f PM'
65+ assert babel .format_datetime (d ) == " Apr 12, 2010, 1:46:00\u202f PM"
6866
69- the_locale = ' de_DE'
70- the_timezone = ' Europe/Vienna'
67+ the_locale = " de_DE"
68+ the_timezone = " Europe/Vienna"
7169
7270 with app .test_request_context ():
73- assert babel .format_datetime (d ) == ' 12.04.2010, 15:46:00'
71+ assert babel .format_datetime (d ) == " 12.04.2010, 15:46:00"
7472
7573
7674def test_refreshing ():
7775 app = flask .Flask (__name__ )
7876 babel .Babel (app )
7977 d = datetime (2010 , 4 , 12 , 13 , 46 )
8078 with app .test_request_context ():
81- assert babel .format_datetime (d ) == ' Apr 12, 2010, 1:46:00\u202f PM'
82- get_babel (app ).default_timezone = ' Europe/Vienna'
79+ assert babel .format_datetime (d ) == " Apr 12, 2010, 1:46:00\u202f PM"
80+ get_babel (app ).default_timezone = " Europe/Vienna"
8381 babel .refresh ()
84- assert babel .format_datetime (d ) == ' Apr 12, 2010, 3:46:00\u202f PM'
82+ assert babel .format_datetime (d ) == " Apr 12, 2010, 3:46:00\u202f PM"
0 commit comments