예제 #1
0
def test_update_vs_insert():
    points = 1000
    data = make_normal(points)
    h1 = StreamHist(maxbins=50)
    h1.update(data)
    h2 = StreamHist(maxbins=50)
    for i, p in enumerate(data):
        h2.insert(p, 1)
        h2.trim()
    h2.trim()

    assert h1.to_dict() == h2.to_dict()
예제 #2
0
def test_update_vs_insert():
    points = 1000
    data = make_normal(points)
    h1 = StreamHist(maxbins=50)
    h1.update(data)
    h2 = StreamHist(maxbins=50)
    for i, p in enumerate(data):
        h2.insert(p, 1)
        h2.trim()
    h2.trim()

    assert h1.to_dict() == h2.to_dict()
예제 #3
0
def test_trim():
    points = 1000
    h = StreamHist(maxbins=10)
    for _ in range(points):
        h.update(rand_int(10))
    assert len(h.bins) == 10 and h.total == points

    h = StreamHist(maxbins=10)
    for _ in range(points):
        h.insert(rand_int(10), 1)
        h.trim()
    assert len(h.bins) == 10 and h.total == points
예제 #4
0
def test_trim():
    points = 1000
    h = StreamHist(maxbins=10)
    for _ in range(points):
        h.update(rand_int(10))
    assert len(h.bins) == 10 and h.total == points

    h = StreamHist(maxbins=10)
    for _ in range(points):
        h.insert(rand_int(10), 1)
        h.trim()
    assert len(h.bins) == 10 and h.total == points