From b88d69ba0fec359d33ca609ea93497a0d4f6b6b9 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Wed, 30 Sep 2026 04:04:15 -0700 Subject: [PATCH 1/2] Synced tests to problem specs and regenerated test file. --- exercises/practice/line-up/.meta/tests.toml | 18 ++++++++ exercises/practice/line-up/line_up.py | 21 ++++++++- exercises/practice/line-up/line_up_test.py | 50 ++++++++++++++++++++- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/exercises/practice/line-up/.meta/tests.toml b/exercises/practice/line-up/.meta/tests.toml index 36fdf1d0cd..dd66fc1585 100644 --- a/exercises/practice/line-up/.meta/tests.toml +++ b/exercises/practice/line-up/.meta/tests.toml @@ -51,9 +51,24 @@ description = "format non-exceptional ordinal numeral 13" [2bdcebc5-c029-4874-b6cc-e9bec80d603a] description = "format exceptional ordinal numeral 21" +[a98e2e22-ab41-4557-a7c2-efedc19c16da] +description = "format exceptional ordinal numeral 22 ending in nd even though it is a multiple of 11" + +[ab45d2fb-e0ee-4016-b605-76917584db0a] +description = "format exceptional ordinal numeral 33 ending in rd even though it is a multiple of 11" + +[c9243603-9f17-45b3-9a41-db9ebdbf08e1] +description = "format exceptional ordinal numeral 52 ending in nd even though it is a multiple of 13" + [74ee2317-0295-49d2-baf0-d56bcefa14e3] description = "format exceptional ordinal numeral 62" +[3f6c408c-4331-42b6-bb6c-3ad0823e568a] +description = "format non-exceptional ordinal numeral 72 ending in nd even though it is a multiple of 12" + +[8db52cd9-9689-413f-a812-6c36fcfd0d07] +description = "format exceptional ordinal numeral 91 ending in st even though it is a multiple of 13" + [b37c332d-7f68-40e3-8503-e43cbd67a0c4] description = "format exceptional ordinal numeral 100" @@ -65,3 +80,6 @@ description = "format non-exceptional ordinal numeral 112" [06b62efe-199e-4ce7-970d-4bf73945713f] description = "format exceptional ordinal numeral 123" + +[6792c54e-59a7-4faf-839a-c4bb61014229] +description = "format large number 972 ending in nd even though it is a multiple of 12" diff --git a/exercises/practice/line-up/line_up.py b/exercises/practice/line-up/line_up.py index c6d20c4e0a..9dfa7481be 100644 --- a/exercises/practice/line-up/line_up.py +++ b/exercises/practice/line-up/line_up.py @@ -1,2 +1,21 @@ +# def line_up(name, number): +# pass def line_up(name, number): - pass + suffix = get_suffix(number) + return f"{name}, you are the {number}{suffix} customer we serve today. Thank you!" + + +def get_suffix(number): + if 11 <= number % 100 <= 13: + return "th" + + mod_10 = number % 10 + + if mod_10 == 1: + return "st" + if mod_10 == 2: + return "nd" + if mod_10 == 3: + return "rd" + + return "th" diff --git a/exercises/practice/line-up/line_up_test.py b/exercises/practice/line-up/line_up_test.py index 1b593c4ddb..e77e55344d 100644 --- a/exercises/practice/line-up/line_up_test.py +++ b/exercises/practice/line-up/line_up_test.py @@ -1,6 +1,6 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/line-up/canonical-data.json -# File last updated on 2026-01-23 +# File last updated on 2026-09-30 import unittest @@ -94,12 +94,52 @@ def test_format_exceptional_ordinal_numeral_21(self): "Washi, you are the 21st customer we serve today. Thank you!", ) + def test_format_exceptional_ordinal_numeral_22_ending_in_nd_even_though_it_is_a_multiple_of_11( + self, + ): + self.assertEqual( + line_up("Ingrid", 22), + "Ingrid, you are the 22nd customer we serve today. Thank you!", + ) + + def test_format_exceptional_ordinal_numeral_33_ending_in_rd_even_though_it_is_a_multiple_of_11( + self, + ): + self.assertEqual( + line_up("Mario", 33), + "Mario, you are the 33rd customer we serve today. Thank you!", + ) + + def test_format_exceptional_ordinal_numeral_52_ending_in_nd_even_though_it_is_a_multiple_of_13( + self, + ): + self.assertEqual( + line_up("Quentin", 52), + "Quentin, you are the 52nd customer we serve today. Thank you!", + ) + def test_format_exceptional_ordinal_numeral_62(self): self.assertEqual( line_up("Nayra", 62), "Nayra, you are the 62nd customer we serve today. Thank you!", ) + def test_format_non_exceptional_ordinal_numeral_72_ending_in_nd_even_though_it_is_a_multiple_of_12( + self, + ): + self.assertEqual( + line_up("Ugo", 72), + "Ugo, you are the 72nd customer we serve today. Thank you!", + ) + + def test_format_exceptional_ordinal_numeral_91_ending_in_st_even_though_it_is_a_multiple_of_13( + self, + ): + self.assertEqual( + line_up("Boris", 91), + "Boris, you are the 91st customer we serve today. Thank you!", + ) + def test_format_exceptional_ordinal_numeral_100(self): self.assertEqual( line_up("John", 100), @@ -123,3 +163,11 @@ def test_format_exceptional_ordinal_numeral_123(self): line_up("Yma", 123), "Yma, you are the 123rd customer we serve today. Thank you!", ) + + def test_format_large_number_972_ending_in_nd_even_though_it_is_a_multiple_of_12( + self, + ): + self.assertEqual( + line_up("Elias", 972), + "Elias, you are the 972nd customer we serve today. Thank you!", + ) From 543ceafbcae7eed859e0b14dd835665d430eb094 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Wed, 30 Sep 2026 04:06:38 -0700 Subject: [PATCH 2/2] Reverted stub so solution isn't published. --- exercises/practice/line-up/line_up.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/exercises/practice/line-up/line_up.py b/exercises/practice/line-up/line_up.py index 9dfa7481be..c6d20c4e0a 100644 --- a/exercises/practice/line-up/line_up.py +++ b/exercises/practice/line-up/line_up.py @@ -1,21 +1,2 @@ -# def line_up(name, number): -# pass def line_up(name, number): - suffix = get_suffix(number) - return f"{name}, you are the {number}{suffix} customer we serve today. Thank you!" - - -def get_suffix(number): - if 11 <= number % 100 <= 13: - return "th" - - mod_10 = number % 10 - - if mod_10 == 1: - return "st" - if mod_10 == 2: - return "nd" - if mod_10 == 3: - return "rd" - - return "th" + pass