(self)
| 5991 | |
| 5992 | |
| 5993 | def test_bogus_dst(self): |
| 5994 | class ok(tzinfo): |
| 5995 | def utcoffset(self, dt): return HOUR |
| 5996 | def dst(self, dt): return HOUR |
| 5997 | |
| 5998 | now = self.theclass.now().replace(tzinfo=utc_real) |
| 5999 | # Doesn't blow up. |
| 6000 | now.astimezone(ok()) |
| 6001 | |
| 6002 | # Does blow up. |
| 6003 | class notok(ok): |
| 6004 | def dst(self, dt): return None |
| 6005 | self.assertRaises(ValueError, now.astimezone, notok()) |
| 6006 | |
| 6007 | # Sometimes blow up. In the following, tzinfo.dst() |
| 6008 | # implementation may return None or not None depending on |
| 6009 | # whether DST is assumed to be in effect. In this situation, |
| 6010 | # a ValueError should be raised by astimezone(). |
| 6011 | class tricky_notok(ok): |
| 6012 | def dst(self, dt): |
| 6013 | if dt.year == 2000: |
| 6014 | return None |
| 6015 | else: |
| 6016 | return 10*HOUR |
| 6017 | dt = self.theclass(2001, 1, 1).replace(tzinfo=utc_real) |
| 6018 | self.assertRaises(ValueError, dt.astimezone, tricky_notok()) |
| 6019 | |
| 6020 | def test_fromutc(self): |
| 6021 | self.assertRaises(TypeError, Eastern.fromutc) # not enough args |
nothing calls this directly
no test coverage detected