MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / test_farthest

Function test_farthest

tests/datetime/test_comparison.py:322–343  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320
321
322def test_farthest():
323 instance = pendulum.datetime(2015, 5, 28, 12, 0, 0)
324 dt1 = pendulum.datetime(2015, 5, 28, 11, 0, 0)
325 dt2 = pendulum.datetime(2015, 5, 28, 14, 0, 0)
326 farthest = instance.farthest(dt1, dt2)
327 assert farthest == dt2
328
329 farthest = instance.farthest(dt2, dt1)
330 assert farthest == dt2
331
332 dts = [
333 pendulum.datetime(2015, 5, 28, 16, 0, 0) + pendulum.duration(hours=x)
334 for x in range(4)
335 ]
336 farthest = instance.farthest(*dts)
337 assert farthest == dts[-1]
338
339 farthest = instance.farthest(*(dts[::-1]))
340 assert farthest == dts[-1]
341
342 f = pendulum.datetime(2010, 1, 1, 0, 0, 0)
343 assert f == instance.farthest(f, *(dts))
344
345
346def test_farthest_with_datetime():

Callers

nothing calls this directly

Calls 2

datetimeMethod · 0.45
farthestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…