|
10 | 10 | # individuals. For the exact contribution history, see the revision |
11 | 11 | # history and logs, available at http://babel.edgewall.org/log/. |
12 | 12 |
|
| 13 | +import datetime |
13 | 14 | import inspect |
14 | 15 | import os |
15 | 16 | import shutil |
16 | 17 | import sys |
17 | 18 | import tempfile |
18 | 19 | import unittest |
19 | | -from datetime import date, datetime, timedelta |
20 | 20 | from io import BytesIO |
21 | 21 |
|
22 | 22 | import pytest |
@@ -296,50 +296,16 @@ def raise_attribute_error(): |
296 | 296 | assert str(exception.value) == 'message' |
297 | 297 |
|
298 | 298 |
|
299 | | -def test_format_date(): |
300 | | - fmt = support.Format('en_US') |
301 | | - assert fmt.date(date(2007, 4, 1)) == 'Apr 1, 2007' |
302 | | - |
| 299 | +WHEN = datetime.datetime(2007, 4, 1, 15, 30) |
303 | 300 |
|
304 | 301 | def test_format_datetime(timezone_getter): |
305 | 302 | fmt = support.Format('en_US', tzinfo=timezone_getter('US/Eastern')) |
306 | | - when = datetime(2007, 4, 1, 15, 30) |
307 | | - assert fmt.datetime(when) == 'Apr 1, 2007, 11:30:00\u202fAM' |
| 303 | + assert fmt.datetime(WHEN) == 'Apr 1, 2007, 11:30:00\u202fAM' |
308 | 304 |
|
309 | 305 |
|
310 | 306 | def test_format_time(timezone_getter): |
311 | 307 | fmt = support.Format('en_US', tzinfo=timezone_getter('US/Eastern')) |
312 | | - assert fmt.time(datetime(2007, 4, 1, 15, 30)) == '11:30:00\u202fAM' |
313 | | - |
314 | | - |
315 | | -def test_format_timedelta(): |
316 | | - fmt = support.Format('en_US') |
317 | | - assert fmt.timedelta(timedelta(weeks=11)) == '3 months' |
318 | | - |
319 | | - |
320 | | -def test_format_number(): |
321 | | - fmt = support.Format('en_US') |
322 | | - assert fmt.number(1099) == '1,099' |
323 | | - |
324 | | - |
325 | | -def test_format_decimal(): |
326 | | - fmt = support.Format('en_US') |
327 | | - assert fmt.decimal(1.2345) == '1.234' |
328 | | - |
329 | | - |
330 | | -def test_format_compact_decimal(): |
331 | | - fmt = support.Format('en_US') |
332 | | - assert fmt.compact_decimal(1234567, format_type='long', fraction_digits=2) == '1.23 million' |
333 | | - |
334 | | - |
335 | | -def test_format_compact_currency(): |
336 | | - fmt = support.Format('en_US') |
337 | | - assert fmt.compact_currency(1234567, "USD", format_type='short', fraction_digits=2) == '$1.23M' |
338 | | - |
339 | | - |
340 | | -def test_format_percent(): |
341 | | - fmt = support.Format('en_US') |
342 | | - assert fmt.percent(0.34) == '34%' |
| 308 | + assert fmt.time(WHEN) == '11:30:00\u202fAM' |
343 | 309 |
|
344 | 310 |
|
345 | 311 | def test_lazy_proxy(): |
|
0 commit comments