Daniel Sheffield 1 рік тому
батько
коміт
68d766c7a5
1 змінених файлів з 20 додано та 0 видалено
  1. 20 0
      test/data/test_decimal.py

+ 20 - 0
test/data/test_decimal.py

@@ -0,0 +1,20 @@
+#
+# Copyright (c) Daniel Sheffield 2023
+#
+# All rights reserved
+#
+# THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY
+from decimal import Decimal
+from pytest import mark
+
+from app.data.decimal_util import(
+    decimal_or_none
+)
+
+@mark.parametrize('maybe_decimal, expected', [
+    ('1', Decimal('1')),
+    ('1.0', Decimal('1.0')),
+    ('', None),
+])
+def test_decimal_or_none(maybe_decimal, expected):
+    assert decimal_or_none(maybe_decimal) == expected