2023-07-15 15:27:31 -07:00
|
|
|
# These tests are auto-generated with test data from:
|
|
|
|
|
# https://github.com/exercism/problem-specifications/tree/main/exercises/meetup/canonical-data.json
|
2023-07-21 16:54:40 -07:00
|
|
|
# File last updated on 2023-07-19
|
2023-07-15 15:27:31 -07:00
|
|
|
|
2023-07-21 16:54:40 -07:00
|
|
|
from datetime import date
|
2019-10-30 19:27:18 +01:00
|
|
|
import unittest
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2021-01-31 16:49:12 -05:00
|
|
|
from meetup import (
|
|
|
|
|
meetup,
|
|
|
|
|
MeetupDayException,
|
|
|
|
|
)
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2019-10-30 19:27:18 +01:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
class MeetupTest(unittest.TestCase):
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_monday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "teenth", "Monday"), date(2013, 5, 13))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_monday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "teenth", "Monday"), date(2013, 8, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_monday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "teenth", "Monday"), date(2013, 9, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_tuesday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "teenth", "Tuesday"), date(2013, 3, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_tuesday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "teenth", "Tuesday"), date(2013, 4, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_tuesday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "teenth", "Tuesday"), date(2013, 8, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_wednesday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "teenth", "Wednesday"), date(2013, 1, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_wednesday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "teenth", "Wednesday"), date(2013, 2, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_wednesday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "teenth", "Wednesday"), date(2013, 6, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_thursday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "teenth", "Thursday"), date(2013, 5, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_thursday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "teenth", "Thursday"), date(2013, 6, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_thursday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "teenth", "Thursday"), date(2013, 9, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_friday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "teenth", "Friday"), date(2013, 4, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_friday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "teenth", "Friday"), date(2013, 8, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_friday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "teenth", "Friday"), date(2013, 9, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_saturday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "teenth", "Saturday"), date(2013, 2, 16))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_saturday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "teenth", "Saturday"), date(2013, 4, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_saturday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "teenth", "Saturday"), date(2013, 10, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_sunday_is_the_19th_the_last_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "teenth", "Sunday"), date(2013, 5, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_sunday_is_some_day_in_the_middle_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "teenth", "Sunday"), date(2013, 6, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_teenth_sunday_is_the_13th_the_first_day_of_the_teenth_week(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "teenth", "Sunday"), date(2013, 10, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_monday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "first", "Monday"), date(2013, 3, 4))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_monday_is_the_1st_the_first_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "first", "Monday"), date(2013, 4, 1))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_tuesday_is_the_7th_the_last_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 5, "first", "Tuesday"), date(2013, 5, 7))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_tuesday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 6, "first", "Tuesday"), date(2013, 6, 4))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_wednesday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 7, "first", "Wednesday"), date(2013, 7, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_wednesday_is_the_7th_the_last_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 8, "first", "Wednesday"), date(2013, 8, 7))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_thursday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 9, "first", "Thursday"), date(2013, 9, 5))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_thursday_is_another_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 10, "first", "Thursday"), date(2013, 10, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_friday_is_the_1st_the_first_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 11, "first", "Friday"), date(2013, 11, 1))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_friday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 12, "first", "Friday"), date(2013, 12, 6))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_saturday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 1, "first", "Saturday"), date(2013, 1, 5))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_saturday_is_another_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 2, "first", "Saturday"), date(2013, 2, 2))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_sunday_is_some_day_in_the_middle_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "first", "Sunday"), date(2013, 3, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_sunday_is_the_7th_the_last_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "first", "Sunday"), date(2013, 4, 7))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_monday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "second", "Monday"), date(2013, 3, 11))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_monday_is_the_8th_the_first_day_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "second", "Monday"), date(2013, 4, 8))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_tuesday_is_the_14th_the_last_day_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 5, "second", "Tuesday"), date(2013, 5, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_tuesday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 6, "second", "Tuesday"), date(2013, 6, 11))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_wednesday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 7, "second", "Wednesday"), date(2013, 7, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_wednesday_is_the_14th_the_last_day_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 8, "second", "Wednesday"), date(2013, 8, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_thursday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 9, "second", "Thursday"), date(2013, 9, 12))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_thursday_is_another_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 10, "second", "Thursday"), date(2013, 10, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_friday_is_the_8th_the_first_day_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 11, "second", "Friday"), date(2013, 11, 8))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_friday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 12, "second", "Friday"), date(2013, 12, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_saturday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 1, "second", "Saturday"), date(2013, 1, 12))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_saturday_is_another_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 2, "second", "Saturday"), date(2013, 2, 9))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_sunday_is_some_day_in_the_middle_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "second", "Sunday"), date(2013, 3, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_second_sunday_is_the_14th_the_last_day_of_the_second_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "second", "Sunday"), date(2013, 4, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_monday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "third", "Monday"), date(2013, 3, 18))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_monday_is_the_15th_the_first_day_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "third", "Monday"), date(2013, 4, 15))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_tuesday_is_the_21st_the_last_day_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 5, "third", "Tuesday"), date(2013, 5, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_tuesday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 6, "third", "Tuesday"), date(2013, 6, 18))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_wednesday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 7, "third", "Wednesday"), date(2013, 7, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_wednesday_is_the_21st_the_last_day_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 8, "third", "Wednesday"), date(2013, 8, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_thursday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 9, "third", "Thursday"), date(2013, 9, 19))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_thursday_is_another_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 10, "third", "Thursday"), date(2013, 10, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_friday_is_the_15th_the_first_day_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 11, "third", "Friday"), date(2013, 11, 15))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_friday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 12, "third", "Friday"), date(2013, 12, 20))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_saturday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 1, "third", "Saturday"), date(2013, 1, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_saturday_is_another_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 2, "third", "Saturday"), date(2013, 2, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_sunday_is_some_day_in_the_middle_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "third", "Sunday"), date(2013, 3, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_third_sunday_is_the_21st_the_last_day_of_the_third_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "third", "Sunday"), date(2013, 4, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_monday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "fourth", "Monday"), date(2013, 3, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_monday_is_the_22nd_the_first_day_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "fourth", "Monday"), date(2013, 4, 22))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_tuesday_is_the_28th_the_last_day_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 5, "fourth", "Tuesday"), date(2013, 5, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_tuesday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 6, "fourth", "Tuesday"), date(2013, 6, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_wednesday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 7, "fourth", "Wednesday"), date(2013, 7, 24))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_wednesday_is_the_28th_the_last_day_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 8, "fourth", "Wednesday"), date(2013, 8, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_thursday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 9, "fourth", "Thursday"), date(2013, 9, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_thursday_is_another_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 10, "fourth", "Thursday"), date(2013, 10, 24))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_friday_is_the_22nd_the_first_day_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 11, "fourth", "Friday"), date(2013, 11, 22))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_friday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 12, "fourth", "Friday"), date(2013, 12, 27))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_saturday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 1, "fourth", "Saturday"), date(2013, 1, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_saturday_is_another_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 2, "fourth", "Saturday"), date(2013, 2, 23))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_sunday_is_some_day_in_the_middle_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 3, "fourth", "Sunday"), date(2013, 3, 24))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_fourth_sunday_is_the_28th_the_last_day_of_the_fourth_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2013, 4, "fourth", "Sunday"), date(2013, 4, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_monday_in_a_month_with_four_mondays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "last", "Monday"), date(2013, 3, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_monday_in_a_month_with_five_mondays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "last", "Monday"), date(2013, 4, 29))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_tuesday_in_a_month_with_four_tuesdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "last", "Tuesday"), date(2013, 5, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_tuesday_in_another_month_with_four_tuesdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "last", "Tuesday"), date(2013, 6, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_wednesday_in_a_month_with_five_wednesdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 7, "last", "Wednesday"), date(2013, 7, 31))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_wednesday_in_a_month_with_four_wednesdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "last", "Wednesday"), date(2013, 8, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_thursday_in_a_month_with_four_thursdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "last", "Thursday"), date(2013, 9, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_thursday_in_a_month_with_five_thursdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "last", "Thursday"), date(2013, 10, 31))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_friday_in_a_month_with_five_fridays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 11, "last", "Friday"), date(2013, 11, 29))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_friday_in_a_month_with_four_fridays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 12, "last", "Friday"), date(2013, 12, 27))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_saturday_in_a_month_with_four_saturdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "last", "Saturday"), date(2013, 1, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_saturday_in_another_month_with_four_saturdays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "last", "Saturday"), date(2013, 2, 23))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_sunday_in_a_month_with_five_sundays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "last", "Sunday"), date(2013, 3, 31))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_sunday_in_a_month_with_four_sundays(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "last", "Sunday"), date(2013, 4, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_last_wednesday_in_february_in_a_leap_year_is_the_29th(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2012, 2, "last", "Wednesday"), date(2012, 2, 29))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_last_wednesday_in_december_that_is_also_the_last_day_of_the_year(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2014, 12, "last", "Wednesday"), date(2014, 12, 31))
|
2015-07-24 12:27:14 +02:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_last_sunday_in_february_in_a_non_leap_year_is_not_the_29th(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2015, 2, "last", "Sunday"), date(2015, 2, 22))
|
2015-08-16 21:35:29 -04:00
|
|
|
|
2022-02-09 19:28:19 -08:00
|
|
|
def test_when_first_friday_is_the_7th_the_last_day_of_the_first_week(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2012, 12, "first", "Friday"), date(2012, 12, 7))
|
2019-10-30 19:27:18 +01:00
|
|
|
|
|
|
|
|
# Additional tests for this track
|
2015-01-02 17:04:41 -05:00
|
|
|
|
2015-02-16 17:38:25 -05:00
|
|
|
def test_fifth_monday_of_march_2015(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2015, 3, "fifth", "Monday"), date(2015, 3, 30))
|
2015-02-16 17:38:25 -05:00
|
|
|
|
2021-11-01 11:22:43 -07:00
|
|
|
def test_fifth_thursday_of_february_2024(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2024, 2, "fifth", "Thursday"), date(2024, 2, 29))
|
2021-11-01 11:22:43 -07:00
|
|
|
|
|
|
|
|
def test_fifth_saturday_of_february_2020(self):
|
2022-04-12 15:44:38 -05:00
|
|
|
self.assertEqual(meetup(2020, 2, "fifth", "Saturday"), date(2020, 2, 29))
|
2021-11-01 11:22:43 -07:00
|
|
|
|
|
|
|
|
def test_last_sunday_of_june_2024(self):
|
|
|
|
|
self.assertEqual(meetup(2024, 6, "last", "Sunday"), date(2024, 6, 30))
|
|
|
|
|
|
|
|
|
|
def test_teenth_friday_of_may_2022(self):
|
|
|
|
|
self.assertEqual(meetup(2022, 5, "teenth", "Friday"), date(2022, 5, 13))
|
|
|
|
|
|
|
|
|
|
def test_nonexistent_fifth_monday_of_february_2022(self):
|
|
|
|
|
with self.assertRaises(MeetupDayException) as err:
|
2022-04-12 15:44:38 -05:00
|
|
|
meetup(2022, 2, "fifth", "Monday")
|
2021-11-01 11:22:43 -07:00
|
|
|
self.assertEqual(type(err.exception), MeetupDayException)
|
|
|
|
|
self.assertEqual(err.exception.args[0], "That day does not exist.")
|
|
|
|
|
|
|
|
|
|
def test_nonexistent_fifth_friday_of_august_2022(self):
|
|
|
|
|
with self.assertRaises(MeetupDayException) as err:
|
2022-04-12 15:44:38 -05:00
|
|
|
meetup(2022, 8, "fifth", "Friday")
|
2021-11-01 11:22:43 -07:00
|
|
|
self.assertEqual(type(err.exception), MeetupDayException)
|
|
|
|
|
self.assertEqual(err.exception.args[0], "That day does not exist.")
|
|
|
|
|
|
|
|
|
|
def test_nonexistent_fifth_thursday_of_may_2023(self):
|
|
|
|
|
with self.assertRaises(MeetupDayException) as err:
|
2022-04-12 15:44:38 -05:00
|
|
|
meetup(2023, 5, "fifth", "Thursday")
|
2021-11-01 11:22:43 -07:00
|
|
|
self.assertEqual(type(err.exception), MeetupDayException)
|
|
|
|
|
self.assertEqual(err.exception.args[0], "That day does not exist.")
|