Synced exercise tests to problem specifications. (#3579)

This commit is contained in:
BethanyG
2023-12-27 05:07:59 -08:00
committed by GitHub
parent c9c67a864f
commit ca3f65e0ad
2 changed files with 22 additions and 17 deletions

View File

@@ -20,6 +20,7 @@ description = "credit and debit"
[502c4106-0371-4e7c-a7d8-9ce33f16ccb1]
description = "multiple entries on same date ordered by description"
include = false
[29dd3659-6c2d-4380-94a8-6d96086e28e1]
description = "final order tie breaker is change"
@@ -41,3 +42,7 @@ description = "Dutch negative number with 3 digits before decimal point"
[29670d1c-56be-492a-9c5e-427e4b766309]
description = "American negative number with 3 digits before decimal point"
[9c70709f-cbbd-4b3b-b367-81d7c6101de4]
description = "multiple entries on same date ordered by description"
reimplements = "502c4106-0371-4e7c-a7d8-9ce33f16ccb1"

View File

@@ -1,6 +1,6 @@
# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/ledger/canonical-data.json
# File last updated on 2023-07-19
# File last updated on 2023-12-27
import unittest
@@ -54,22 +54,6 @@ class LedgerTest(unittest.TestCase):
)
self.assertEqual(format_entries(currency, locale, entries), expected)
def test_multiple_entries_on_same_date_ordered_by_description(self):
currency = "USD"
locale = "en_US"
entries = [
create_entry("2015-01-02", "Get present", 1000),
create_entry("2015-01-01", "Buy present", -1000),
]
expected = "\n".join(
[
"Date | Description | Change ",
"01/01/2015 | Buy present | ($10.00)",
"01/02/2015 | Get present | $10.00 ",
]
)
self.assertEqual(format_entries(currency, locale, entries), expected)
def test_final_order_tie_breaker_is_change(self):
currency = "USD"
locale = "en_US"
@@ -171,3 +155,19 @@ class LedgerTest(unittest.TestCase):
]
)
self.assertEqual(format_entries(currency, locale, entries), expected)
def test_multiple_entries_on_same_date_ordered_by_description(self):
currency = "USD"
locale = "en_US"
entries = [
create_entry("2015-01-01", "Get present", 1000),
create_entry("2015-01-01", "Buy present", -1000),
]
expected = "\n".join(
[
"Date | Description | Change ",
"01/01/2015 | Buy present | ($10.00)",
"01/01/2015 | Get present | $10.00 ",
]
)
self.assertEqual(format_entries(currency, locale, entries), expected)