Skip to content

Commit

Permalink
Update and rename test_decimal.py to test_numbers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas committed Jul 31, 2024
1 parent 72244c6 commit 0a01b41
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/test_decimal.py → tests/test_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from django_twc_toolbox.decimal import format_decimal_places
from django_twc_toolbox.numbers import format_number_no_round


@pytest.mark.parametrize(
Expand All @@ -28,8 +28,8 @@
(123.456789, 4, "123.456789"),
],
)
def test_format_decimal_places_float(number, decimal_places, expected):
result = format_decimal_places(number, decimal_places=decimal_places)
def test_format_number_no_round_float(number, decimal_places, expected):
result = format_number_no_round(number, decimal_places=decimal_places)

assert isinstance(result, str)
assert result == expected
Expand Down Expand Up @@ -58,8 +58,8 @@ def test_format_decimal_places_float(number, decimal_places, expected):
("123.456789", 4, "123.456789"),
],
)
def test_format_decimal_places_str(number, decimal_places, expected):
result = format_decimal_places(number, decimal_places=decimal_places)
def test_format_number_no_round_str(number, decimal_places, expected):
result = format_number_no_round(number, decimal_places=decimal_places)

assert isinstance(result, str)
assert result == expected
Expand Down Expand Up @@ -87,8 +87,8 @@ def test_format_decimal_places_str(number, decimal_places, expected):
(Decimal("123.456789"), 4, Decimal("123.456789")),
],
)
def test_format_decimal_places_decimal(number, decimal_places, expected):
result = format_decimal_places(number, decimal_places=decimal_places)
def test_format_number_no_round_decimal(number, decimal_places, expected):
result = format_number_no_round(number, decimal_places=decimal_places)

assert isinstance(result, Decimal)
assert result == expected
Expand All @@ -102,14 +102,14 @@ def test_format_decimal_places_decimal(number, decimal_places, expected):
(7, "123.4567890"),
],
)
def test_format_decimal_places_arg(decimal_places, expected):
def test_format_number_no_round_arg(decimal_places, expected):
number = "123.456789"

result = format_decimal_places(number, decimal_places=decimal_places)
result = format_number_no_round(number, decimal_places=decimal_places)

assert result == expected


def test_format_decimal_places_invalid_input():
def test_format_number_no_round_invalid_input():
with pytest.raises(ValueError):
format_decimal_places("invalid", decimal_places=2)
format_number_no_round("invalid", decimal_places=2)

0 comments on commit 0a01b41

Please sign in to comment.