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