(self)
| 4191 | class TZInfoBase: |
| 4192 | |
| 4193 | def test_argument_passing(self): |
| 4194 | cls = self.theclass |
| 4195 | # A datetime passes itself on, a time passes None. |
| 4196 | class introspective(tzinfo): |
| 4197 | def tzname(self, dt): return dt and "real" or "none" |
| 4198 | def utcoffset(self, dt): |
| 4199 | return timedelta(minutes = dt and 42 or -42) |
| 4200 | dst = utcoffset |
| 4201 | |
| 4202 | obj = cls(1, 2, 3, tzinfo=introspective()) |
| 4203 | |
| 4204 | expected = cls is time and "none" or "real" |
| 4205 | self.assertEqual(obj.tzname(), expected) |
| 4206 | |
| 4207 | expected = timedelta(minutes=(cls is time and -42 or 42)) |
| 4208 | self.assertEqual(obj.utcoffset(), expected) |
| 4209 | self.assertEqual(obj.dst(), expected) |
| 4210 | |
| 4211 | def test_bad_tzinfo_classes(self): |
| 4212 | cls = self.theclass |
nothing calls this directly
no test coverage detected