Skip to content

Commit e74d30a

Browse files
committed
Update currency documentation and enhance pretty_price_range tests for consistency
1 parent 6356365 commit e74d30a

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

docs/currency.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ Formats a price range.
7272
from tna_utilities.currency import pretty_price_range
7373

7474
print(pretty_price_range(5, 10))
75-
# £5.00 to £10
75+
# £5 to £10
7676

7777
print(pretty_price_range(0, 15))
78-
# Free to £15.00
78+
# Free to £15
7979

8080
print(pretty_price_range(10, 0))
81-
# From £10.00
81+
# From £10
8282
```

tests/test_currency.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ def test_happy(self):
8888
self.assertEqual(pretty_price_range(5, 0), "From £5")
8989
self.assertEqual(pretty_price_range(5, 10), "£5 to £10")
9090
self.assertEqual(pretty_price_range(10, 5), "£5 to £10")
91+
self.assertEqual(pretty_price_range(10, 0), "From £10")
92+
self.assertEqual(pretty_price_range(0, 5, False), "Free to £5.00")
93+
self.assertEqual(pretty_price_range(5, 10, False), "£5.00 to £10.00")
94+
self.assertEqual(pretty_price_range(5, 0, False), "From £5.00")
95+
self.assertEqual(pretty_price_range(5, 1, False), "£1.00 to £5.00")
96+
97+
def test_unhappy(self):
9198
with self.assertRaises(ValueError):
9299
pretty_price_range(5, "a")
93100
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)