Skip to content

Commit 1c39ffd

Browse files
committed
Added new leapyear test case and regenerated test cases and tests toml.
1 parent 849db54 commit 1c39ffd

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

exercises/practice/swift-scheduling/.meta/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def delivery_date(start, description):
1212
due_date = start_date.replace(hour=17, minute=0)
1313
else:
1414
due_date = (
15-
start_date.replace(hour=12, minute=0) +
15+
start_date.replace(hour=13, minute=0) +
1616
timedelta(days=1)
1717
)
1818
case 'EOW':
@@ -54,4 +54,4 @@ def delivery_date(start, description):
5454
if due_date.isoweekday() == 7:
5555
due_date -= timedelta(days=2)
5656

57-
return due_date.isoformat()
57+
return due_date.isoformat()

exercises/practice/swift-scheduling/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ description = "EOW on Thursday translates to Sunday at eight in the evening"
2929
[bbffccf7-97f7-4244-888d-bdd64348fa2e]
3030
description = "EOW on Friday translates to Sunday at eight in the evening"
3131

32+
[d651fcf4-290e-407c-8107-36b9076f39b2]
33+
description = "EOW translates to leap day"
34+
3235
[439bf09f-3a0e-44e7-bad5-b7b6d0c4505a]
3336
description = "2M before the second month of this year translates to the first workday of the second month of this year"
3437

exercises/practice/swift-scheduling/swift_scheduling_test.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These tests are auto-generated with test data from:
22
# https://github.com/exercism/problem-specifications/tree/main/exercises/swift-scheduling/canonical-data.json
3-
# File last updated on 2025-03-02
3+
# File last updated on 2025-03-03
44

55
import unittest
66

@@ -15,14 +15,25 @@ def test_now_translates_to_two_hours_later(self):
1515
delivery_date("2012-02-13T09:00:00", "NOW"), "2012-02-13T11:00:00"
1616
)
1717

18-
def test_asap_before_noon_translates_to_today_at_five_in_the_afternoon(self):
18+
def test_asap_before_one_in_the_afternoon_translates_to_today_at_five_in_the_afternoon(
19+
self,
20+
):
1921
self.assertEqual(
2022
delivery_date("1999-06-03T09:45:00", "ASAP"), "1999-06-03T17:00:00"
2123
)
2224

23-
def test_asap_after_noon_translates_to_tomorrow_at_noon(self):
25+
def test_asap_at_one_in_the_afternoon_translates_to_tomorrow_at_one_in_the_afternoon(
26+
self,
27+
):
28+
self.assertEqual(
29+
delivery_date("2008-12-21T13:00:00", "ASAP"), "2008-12-22T13:00:00"
30+
)
31+
32+
def test_asap_after_one_in_the_afternoon_translates_to_tomorrow_at_one_in_the_afternoon(
33+
self,
34+
):
2435
self.assertEqual(
25-
delivery_date("2008-12-21T13:30:00", "ASAP"), "2008-12-22T12:00:00"
36+
delivery_date("2008-12-21T14:50:00", "ASAP"), "2008-12-22T13:00:00"
2637
)
2738

2839
def test_eow_on_monday_translates_to_friday_at_five_in_the_afternoon(self):
@@ -47,7 +58,12 @@ def test_eow_on_thursday_translates_to_sunday_at_eight_in_the_evening(self):
4758

4859
def test_eow_on_friday_translates_to_sunday_at_eight_in_the_evening(self):
4960
self.assertEqual(
50-
delivery_date("2022-08-05T12:00:00", "EOW"), "2022-08-07T20:00:00"
61+
delivery_date("2022-08-05T14:00:00", "EOW"), "2022-08-07T20:00:00"
62+
)
63+
64+
def test_eow_translates_to_leap_day(self):
65+
self.assertEqual(
66+
delivery_date("2008-02-25T10:30:00", "EOW"), "2008-02-29T17:00:00"
5167
)
5268

5369
def test_2_m_before_the_second_month_of_this_year_translates_to_the_first_workday_of_the_second_month_of_this_year(

0 commit comments

Comments
 (0)