diff --git a/tests/test_api.py b/tests/test_api.py index 4374b9d..400304e 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -187,6 +187,12 @@ def test_integer(): assert isinstance(i, Integer) +def test_decimal(): + d = tomlkit.decimal("34.56") + + assert isinstance(d, String) + + def test_float(): i = tomlkit.float_("34.56") diff --git a/tests/test_items.py b/tests/test_items.py index 45aea25..2fd0566 100644 --- a/tests/test_items.py +++ b/tests/test_items.py @@ -2,6 +2,7 @@ import math import pickle +from decimal import Decimal from datetime import date from datetime import datetime from datetime import time @@ -90,6 +91,16 @@ def test_integer_unwrap(): elementary_test(item(666), int) +def test_decimal_unwrap(): + """Ensure a decimal unwraps as a string + after TOML encode. + """ + elementary_test( + item(Decimal("0.001")), + str, + ) + + def test_float_unwrap(): elementary_test(item(2.78), float)