MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_argument_passing

Method test_argument_passing

Lib/test/datetimetester.py:4193–4209  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4191class 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

Callers

nothing calls this directly

Calls 7

timedeltaClass · 0.90
introspectiveClass · 0.85
clsClass · 0.50
assertEqualMethod · 0.45
tznameMethod · 0.45
utcoffsetMethod · 0.45
dstMethod · 0.45

Tested by

no test coverage detected