This generates tests about how the behavior of a function ``func`` changes between STD and DST (e.g. utcoffset, tzname, dst). It assume that DST starts the 2nd Sunday in March and ends the 1st Sunday in November
(self, tzval, func, std_val, dst_val)
| 880 | return TZEnvContext(tzname_map.get(tzname, tzname)) |
| 881 | |
| 882 | def _testTzFunc(self, tzval, func, std_val, dst_val): |
| 883 | """ |
| 884 | This generates tests about how the behavior of a function ``func`` |
| 885 | changes between STD and DST (e.g. utcoffset, tzname, dst). |
| 886 | |
| 887 | It assume that DST starts the 2nd Sunday in March and ends the 1st |
| 888 | Sunday in November |
| 889 | """ |
| 890 | with TZEnvContext(tzval): |
| 891 | dt1 = datetime(2015, 2, 1, 12, 0, tzinfo=tz.tzlocal()) # STD |
| 892 | dt2 = datetime(2015, 5, 1, 12, 0, tzinfo=tz.tzlocal()) # DST |
| 893 | |
| 894 | self.assertEqual(func(dt1), std_val) |
| 895 | self.assertEqual(func(dt2), dst_val) |
| 896 | |
| 897 | def _testTzName(self, tzval, std_name, dst_name): |
| 898 | func = datetime.tzname |
no test coverage detected