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

Function test_closest_with_datetime

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

Source from the content-addressed store, hash-verified

296
297
298def test_closest_with_datetime():
299 instance = pendulum.datetime(2015, 5, 28, 12, 0, 0)
300 dt1 = datetime(2015, 5, 28, 11, 0, 0)
301 dt2 = datetime(2015, 5, 28, 14, 0, 0)
302 closest = instance.closest(dt1, dt2)
303 assert_datetime(closest, 2015, 5, 28, 11, 0, 0)
304
305 dts = [
306 pendulum.datetime(2015, 5, 28, 16, 0, 0) + pendulum.duration(hours=x)
307 for x in range(4)
308 ]
309 closest = instance.closest(dt1, dt2, *dts)
310
311 assert_datetime(closest, 2015, 5, 28, 11, 0, 0)
312
313
314def test_closest_with_equals():

Callers

nothing calls this directly

Calls 4

assert_datetimeFunction · 0.90
datetimeFunction · 0.85
datetimeMethod · 0.45
closestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…