def testNegativeAxis(): "Tests creation and filling of negative bin sets" a = Hist(range(-10,11)) a.fill(-9.5) assert a[0] == 1 a.fill(-3.2) assert a[6] == 1
def testArrayFill(): a = Hist(range(101)) a.fill([0.5, 1.5]) assert a[0] == 1 assert a[1] == 1 a.fill([2.5, 3.5], [0.4, 0.5]) assert a[2] == 0.4 assert a[3] == 0.5
def testBasicFill(): "Tests the elementary filling functions" a = Hist(range(101)) a.fill(0.5) assert a[0] == 1.0 # And, with weights a.fill(1.0, 0.5) assert a[1] == 0.5
def testFillEdges(): "Tests the filling edge cases" a = Hist(range(101)) # Test that the overflow edge is good a.fill(100) assert a[99] == 0.0 a.fill(99.9999999) assert a[99] == 1.0 a.fill(0) assert a[0] == 1.0