(ymd_tuple, test_reason)
| 764 | # Should be able to infer date if given year, week of year (%U or %W) |
| 765 | # and day of the week |
| 766 | def test_helper(ymd_tuple, test_reason): |
| 767 | for year_week_format in ('%Y %W', '%Y %U', '%G %V'): |
| 768 | if (year_week_format in self._formats_excluded and |
| 769 | ymd_tuple in self._ymd_excluded): |
| 770 | return |
| 771 | for weekday_format in ('%w', '%u', '%a', '%A'): |
| 772 | format_string = year_week_format + ' ' + weekday_format |
| 773 | with self.subTest(test_reason, |
| 774 | date=ymd_tuple, |
| 775 | format=format_string): |
| 776 | dt_date = datetime_date(*ymd_tuple) |
| 777 | strp_input = dt_date.strftime(format_string) |
| 778 | strp_output = _strptime._strptime_time(strp_input, |
| 779 | format_string) |
| 780 | msg = "%r: %s != %s" % (strp_input, |
| 781 | strp_output[7], |
| 782 | dt_date.timetuple()[7]) |
| 783 | self.assertEqual(strp_output[:3], ymd_tuple, msg) |
| 784 | test_helper((1901, 1, 3), "week 0") |
| 785 | test_helper((1901, 1, 8), "common case") |
| 786 | test_helper((1901, 1, 13), "day on Sunday") |
nothing calls this directly
no test coverage detected