summaryrefslogtreecommitdiff
path: root/tests/test_smoke.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2016-04-08 08:34:31 +0300
committerAarni Koskela <akx@iki.fi>2016-04-08 09:13:05 +0300
commit971e7060082a8297947351db6c5aa6ce12fb0b7b (patch)
tree29c744b3776b94ab3516b2ea7a9bc0cc13651404 /tests/test_smoke.py
parentc028a09a283dd2f62c747862d08da39fc62ed6ed (diff)
downloadbabel-971e7060082a8297947351db6c5aa6ce12fb0b7b.tar.gz
Add smoke tests for basic operations
Refs #378
Diffstat (limited to 'tests/test_smoke.py')
-rw-r--r--tests/test_smoke.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_smoke.py b/tests/test_smoke.py
new file mode 100644
index 0000000..eda10ed
--- /dev/null
+++ b/tests/test_smoke.py
@@ -0,0 +1,37 @@
+# -- encoding: UTF-8 --
+"""
+These tests do not verify any results and should not be run when
+looking at improving test coverage. They just verify that basic
+operations don't fail due to odd corner cases on any locale that
+we ship.
+"""
+from datetime import datetime
+
+import pytest
+from babel import Locale
+from babel import dates
+from babel import numbers
+from babel._compat import Decimal
+
+
+@pytest.mark.all_locales
+def test_smoke_dates(locale):
+ locale = Locale.parse(locale)
+ instant = datetime.now()
+ for width in ("full", "long", "medium", "short"):
+ assert dates.format_date(instant, format=width, locale=locale)
+ assert dates.format_datetime(instant, format=width, locale=locale)
+ assert dates.format_time(instant, format=width, locale=locale)
+
+
+@pytest.mark.all_locales
+def test_smoke_numbers(locale):
+ locale = Locale.parse(locale)
+ for number in (
+ Decimal("-33.76"), # Negative Decimal
+ Decimal("13.37"), # Positive Decimal
+ 1.2 - 1.0, # Inaccurate float
+ 10, # Plain old integer
+ 0, # Zero
+ ):
+ assert numbers.format_number(number, locale=locale)