summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-01-20 18:53:47 +0200
committerGitHub <noreply@github.com>2023-01-20 18:53:47 +0200
commit2a4b78446f6553957d6181b9baad3ba2ecf4a2cc (patch)
treee02f6f8f8cc10c2039a63590cad50770d31e1b58 /tests
parent61be9dc5d6c9ed7d1fb9116ae81a205a5fbee473 (diff)
downloadbabel-2a4b78446f6553957d6181b9baad3ba2ecf4a2cc.tar.gz
Remove redundant tests for babel.support (#954)
The doctests test the exact same things.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_support.py42
1 files changed, 4 insertions, 38 deletions
diff --git a/tests/test_support.py b/tests/test_support.py
index a471137..7c0235c 100644
--- a/tests/test_support.py
+++ b/tests/test_support.py
@@ -10,13 +10,13 @@
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://babel.edgewall.org/log/.
+import datetime
import inspect
import os
import shutil
import sys
import tempfile
import unittest
-from datetime import date, datetime, timedelta
from io import BytesIO
import pytest
@@ -296,50 +296,16 @@ class LazyProxyTestCase(unittest.TestCase):
assert str(exception.value) == 'message'
-def test_format_date():
- fmt = support.Format('en_US')
- assert fmt.date(date(2007, 4, 1)) == 'Apr 1, 2007'
-
+WHEN = datetime.datetime(2007, 4, 1, 15, 30)
def test_format_datetime(timezone_getter):
fmt = support.Format('en_US', tzinfo=timezone_getter('US/Eastern'))
- when = datetime(2007, 4, 1, 15, 30)
- assert fmt.datetime(when) == 'Apr 1, 2007, 11:30:00\u202fAM'
+ assert fmt.datetime(WHEN) == 'Apr 1, 2007, 11:30:00\u202fAM'
def test_format_time(timezone_getter):
fmt = support.Format('en_US', tzinfo=timezone_getter('US/Eastern'))
- assert fmt.time(datetime(2007, 4, 1, 15, 30)) == '11:30:00\u202fAM'
-
-
-def test_format_timedelta():
- fmt = support.Format('en_US')
- assert fmt.timedelta(timedelta(weeks=11)) == '3 months'
-
-
-def test_format_number():
- fmt = support.Format('en_US')
- assert fmt.number(1099) == '1,099'
-
-
-def test_format_decimal():
- fmt = support.Format('en_US')
- assert fmt.decimal(1.2345) == '1.234'
-
-
-def test_format_compact_decimal():
- fmt = support.Format('en_US')
- assert fmt.compact_decimal(1234567, format_type='long', fraction_digits=2) == '1.23 million'
-
-
-def test_format_compact_currency():
- fmt = support.Format('en_US')
- assert fmt.compact_currency(1234567, "USD", format_type='short', fraction_digits=2) == '$1.23M'
-
-
-def test_format_percent():
- fmt = support.Format('en_US')
- assert fmt.percent(0.34) == '34%'
+ assert fmt.time(WHEN) == '11:30:00\u202fAM'
def test_lazy_proxy():