(self)
| 4374 | class TZInfoBase: |
| 4375 | |
| 4376 | def test_argument_passing(self): |
| 4377 | cls = self.theclass |
| 4378 | # A datetime passes itself on, a time passes None. |
| 4379 | class introspective(tzinfo): |
| 4380 | def tzname(self, dt): return dt and "real" or "none" |
| 4381 | def utcoffset(self, dt): |
| 4382 | return timedelta(minutes = dt and 42 or -42) |
| 4383 | dst = utcoffset |
| 4384 | |
| 4385 | obj = cls(1, 2, 3, tzinfo=introspective()) |
| 4386 | |
| 4387 | expected = cls is time and "none" or "real" |
| 4388 | self.assertEqual(obj.tzname(), expected) |
| 4389 | |
| 4390 | expected = timedelta(minutes=(cls is time and -42 or 42)) |
| 4391 | self.assertEqual(obj.utcoffset(), expected) |
| 4392 | self.assertEqual(obj.dst(), expected) |
| 4393 | |
| 4394 | def test_bad_tzinfo_classes(self): |
| 4395 | cls = self.theclass |
nothing calls this directly
no test coverage detected