Exemple #1
0
def test_binsearch_duplicates_hi_edge(wn0, upper, result):
    wn = np.array([1.0, 1.0, 2.0, 2.0, 2.0, 2.0])
    with open('outputs/binsearch.dat', 'wb') as tli:
        tli.write(struct.pack(str(len(wn)) + "d", *list(wn)))
    with open('outputs/binsearch.dat', 'rb') as tli:
        assert pt.binsearch(tli, wn0, 0, len(wn), upper) == result
Exemple #2
0
def test_binsearch_zero():
    with pytest.raises(
            ValueError,
            match='Requested binsearch over a zero a zero-sized array.'):
        pt.binsearch('dummy.dat', 1.0, 0, nrec=0, upper=True)