MCPcopy Create free account
hub / github.com/chaimleib/intervaltree / test_slice_datafunc

Function test_slice_datafunc

test/intervaltree_methods/restructure_test.py:544–565  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

542
543
544def test_slice_datafunc():
545 def datafunc(iv, islower):
546 oldlimit = iv[islower]
547 return "oldlimit: {0}, islower: {1}".format(oldlimit, islower)
548
549 t = IntervalTree([Interval(5, 15)])
550 t.slice(10, datafunc)
551 assert sorted(t)[0] == Interval(5, 10, 'oldlimit: 15, islower: True')
552 assert sorted(t)[1] == Interval(10, 15, 'oldlimit: 5, islower: False')
553
554 t = IntervalTree([Interval(5, 15)])
555 t.slice(5, datafunc)
556 assert sorted(t)[0] == Interval(5, 15)
557
558 t.slice(15, datafunc)
559 assert sorted(t)[0] == Interval(5, 15)
560
561 t.slice(0, datafunc)
562 assert sorted(t)[0] == Interval(5, 15)
563
564 t.slice(20, datafunc)
565 assert sorted(t)[0] == Interval(5, 15)
566
567
568# -----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

sliceMethod · 0.95
IntervalTreeClass · 0.90
IntervalClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…