2017-03-23 13:37:20 +01:00
|
|
|
from datetime import date
|
2019-10-30 19:27:18 +01:00
|
|
|
import unittest
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2019-05-30 06:22:07 -07:00
|
|
|
from meetup import meetup, MeetupDayException
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2020-10-15 12:46:24 -04:00
|
|
|
# Tests adapted from `problem-specifications//canonical-data.json`
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2019-10-30 19:27:18 +01:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
class MeetupTest(unittest.TestCase):
|
|
|
|
|
def test_monteenth_of_may_2013(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
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_monteenth_of_august_2013(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
|
|
|
|
|
|
|
|
def test_monteenth_of_september_2013(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
|
|
|
|
|
|
|
|
def test_tuesteenth_of_march_2013(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
|
|
|
|
|
|
|
|
def test_tuesteenth_of_april_2013(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
|
|
|
|
|
|
|
|
def test_tuesteenth_of_august_2013(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
|
|
|
|
|
|
|
|
def test_wednesteenth_of_january_2013(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
|
|
|
|
|
|
|
|
def test_wednesteenth_of_february_2013(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
|
|
|
|
|
|
|
|
def test_wednesteenth_of_june_2013(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
|
|
|
|
|
|
|
|
def test_thursteenth_of_may_2013(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
|
|
|
|
|
|
|
|
def test_thursteenth_of_june_2013(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
|
|
|
|
|
|
|
|
def test_thursteenth_of_september_2013(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
|
|
|
|
|
|
|
|
def test_friteenth_of_april_2013(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
|
|
|
|
|
|
|
|
def test_friteenth_of_august_2013(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
|
|
|
|
|
|
|
|
def test_friteenth_of_september_2013(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
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_saturteenth_of_february_2013(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
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_saturteenth_of_april_2013(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
|
|
|
|
|
|
|
|
def test_saturteenth_of_october_2013(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
|
|
|
|
|
|
|
|
def test_sunteenth_of_may_2013(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
|
|
|
|
|
|
|
|
def test_sunteenth_of_june_2013(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
|
|
|
|
|
|
|
|
def test_sunteenth_of_october_2013(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
|
|
|
|
|
|
|
|
def test_first_monday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "1st", "Monday"), date(2013, 3, 4))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_monday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "1st", "Monday"), date(2013, 4, 1))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_first_tuesday_of_may_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "1st", "Tuesday"), date(2013, 5, 7))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_first_tuesday_of_june_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "1st", "Tuesday"), date(2013, 6, 4))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_wednesday_of_july_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 7, "1st", "Wednesday"), date(2013, 7, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_wednesday_of_august_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "1st", "Wednesday"), date(2013, 8, 7))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_thursday_of_september_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "1st", "Thursday"), date(2013, 9, 5))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_thursday_of_october_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "1st", "Thursday"), date(2013, 10, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_friday_of_november_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 11, "1st", "Friday"), date(2013, 11, 1))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_friday_of_december_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 12, "1st", "Friday"), date(2013, 12, 6))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_saturday_of_january_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "1st", "Saturday"), date(2013, 1, 5))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_saturday_of_february_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "1st", "Saturday"), date(2013, 2, 2))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_sunday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "1st", "Sunday"), date(2013, 3, 3))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_first_sunday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "1st", "Sunday"), date(2013, 4, 7))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_monday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "2nd", "Monday"), date(2013, 3, 11))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_second_monday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "2nd", "Monday"), date(2013, 4, 8))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_second_tuesday_of_may_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "2nd", "Tuesday"), date(2013, 5, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_tuesday_of_june_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "2nd", "Tuesday"), date(2013, 6, 11))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_wednesday_of_july_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 7, "2nd", "Wednesday"), date(2013, 7, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_wednesday_of_august_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "2nd", "Wednesday"), date(2013, 8, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_thursday_of_september_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "2nd", "Thursday"), date(2013, 9, 12))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_thursday_of_october_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "2nd", "Thursday"), date(2013, 10, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_friday_of_november_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 11, "2nd", "Friday"), date(2013, 11, 8))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_friday_of_december_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 12, "2nd", "Friday"), date(2013, 12, 13))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_saturday_of_january_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "2nd", "Saturday"), date(2013, 1, 12))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_saturday_of_february_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "2nd", "Saturday"), date(2013, 2, 9))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_sunday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "2nd", "Sunday"), date(2013, 3, 10))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_second_sunday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "2nd", "Sunday"), date(2013, 4, 14))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_monday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "3rd", "Monday"), date(2013, 3, 18))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_monday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "3rd", "Monday"), date(2013, 4, 15))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_tuesday_of_may_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "3rd", "Tuesday"), date(2013, 5, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_tuesday_of_june_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "3rd", "Tuesday"), date(2013, 6, 18))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_wednesday_of_july_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 7, "3rd", "Wednesday"), date(2013, 7, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_wednesday_of_august_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "3rd", "Wednesday"), date(2013, 8, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_third_thursday_of_september_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "3rd", "Thursday"), date(2013, 9, 19))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_third_thursday_of_october_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "3rd", "Thursday"), date(2013, 10, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_friday_of_november_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 11, "3rd", "Friday"), date(2013, 11, 15))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_friday_of_december_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 12, "3rd", "Friday"), date(2013, 12, 20))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_saturday_of_january_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "3rd", "Saturday"), date(2013, 1, 19))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_saturday_of_february_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "3rd", "Saturday"), date(2013, 2, 16))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_sunday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "3rd", "Sunday"), date(2013, 3, 17))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_third_sunday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "3rd", "Sunday"), date(2013, 4, 21))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_monday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "4th", "Monday"), date(2013, 3, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_monday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "4th", "Monday"), date(2013, 4, 22))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_tuesday_of_may_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 5, "4th", "Tuesday"), date(2013, 5, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_tuesday_of_june_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 6, "4th", "Tuesday"), date(2013, 6, 25))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_wednesday_of_july_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 7, "4th", "Wednesday"), date(2013, 7, 24))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_wednesday_of_august_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 8, "4th", "Wednesday"), date(2013, 8, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_thursday_of_september_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 9, "4th", "Thursday"), date(2013, 9, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_thursday_of_october_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 10, "4th", "Thursday"), date(2013, 10, 24))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_friday_of_november_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 11, "4th", "Friday"), date(2013, 11, 22))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_friday_of_december_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 12, "4th", "Friday"), date(2013, 12, 27))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_saturday_of_january_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 1, "4th", "Saturday"), date(2013, 1, 26))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_fourth_saturday_of_february_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 2, "4th", "Saturday"), date(2013, 2, 23))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_fourth_sunday_of_march_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 3, "4th", "Sunday"), date(2013, 3, 24))
|
2014-04-02 18:11:17 +02:00
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_fourth_sunday_of_april_2013(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2013, 4, "4th", "Sunday"), date(2013, 4, 28))
|
2017-05-07 14:24:54 +02:00
|
|
|
|
|
|
|
|
def test_last_monday_of_march_2013(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
|
|
|
|
|
|
|
|
def test_last_monday_of_april_2013(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
|
|
|
|
|
|
|
|
def test_last_tuesday_of_may_2013(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
|
|
|
|
|
|
|
|
def test_last_tuesday_of_june_2013(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
|
|
|
|
|
|
|
|
def test_last_wednesday_of_july_2013(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
|
|
|
|
|
|
|
|
def test_last_wednesday_of_august_2013(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
|
|
|
|
|
|
|
|
def test_last_thursday_of_september_2013(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
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_last_thursday_of_october_2013(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
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_last_friday_of_november_2013(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
|
|
|
|
|
|
|
|
def test_last_friday_of_december_2013(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
|
|
|
|
|
|
|
|
def test_last_saturday_of_january_2013(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
|
|
|
|
|
|
|
|
def test_last_saturday_of_february_2013(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
|
|
|
|
|
|
|
|
def test_last_sunday_of_march_2013(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
|
|
|
|
|
|
|
|
def test_last_sunday_of_april_2013(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
|
|
|
|
2014-04-02 18:11:17 +02:00
|
|
|
def test_last_wednesday_of_february_2012(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
|
|
|
|
2015-07-24 12:27:14 +02:00
|
|
|
def test_last_wednesday_of_december_2014(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
|
|
|
|
2017-05-07 14:24:54 +02:00
|
|
|
def test_last_sunday_of_february_2015(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
|
|
|
|
2015-01-02 17:04:41 -05:00
|
|
|
def test_first_friday_of_december_2012(self):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2012, 12, "1st", "Friday"), date(2012, 12, 7))
|
|
|
|
|
|
|
|
|
|
# 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):
|
2019-10-30 19:27:18 +01:00
|
|
|
self.assertEqual(meetup(2015, 3, "5th", "Monday"), date(2015, 3, 30))
|
2015-02-16 17:38:25 -05:00
|
|
|
|
|
|
|
|
def test_nonexistent_fifth_monday_of_february_2015(self):
|
2017-12-12 18:11:43 +00:00
|
|
|
with self.assertRaisesWithMessage(MeetupDayException):
|
2019-10-30 19:27:18 +01:00
|
|
|
meetup(2015, 2, "5th", "Monday")
|
2015-02-16 17:38:25 -05:00
|
|
|
|
2017-12-12 18:11:43 +00:00
|
|
|
# Utility functions
|
|
|
|
|
def assertRaisesWithMessage(self, exception):
|
|
|
|
|
return self.assertRaisesRegex(exception, r".+")
|
|
|
|
|
|
2016-11-29 09:44:47 +01:00
|
|
|
|
2019-10-30 19:27:18 +01:00
|
|
|
if __name__ == "__main__":
|
2014-04-02 18:11:17 +02:00
|
|
|
unittest.main()
|