예제 #1
0
def test_track_floats_ints_unique_in_cardinality_estimate():
    vals = [1, 2, 3, 4]
    x = NumberTracker()
    for val in vals:
        x.track(val)

    assert x.to_summary().unique_count.estimate == 4

    for val in vals:
        x.track(float(val))

    assert x.to_summary().unique_count.estimate == 8
예제 #2
0
def test_high_cardinality_not_discrete():
    vals = 3 * [1, 2, 3] + [4.0, 6.0, 9.0, 9.0]
    x = NumberTracker()
    for v in vals:
        x.track(v)
    summary = x.to_summary()
    assert not summary.is_discrete
예제 #3
0
def test_low_cardinality_is_discrete():
    vals = 3 * [1, 2, 3] + [4.0, 6.0, 9.0, 9.0]
    vals = vals * 10
    x = NumberTracker()
    for v in vals:
        x.track(v)
    summary = x.to_summary()
    assert summary.is_discrete
예제 #4
0
def test_not_discrete_if_float_is_present():
    vals = 3 * [1, 2, 3] + [4.0, 6.0, 9.0, 9.0]
    vals = vals * 10
    x = NumberTracker()
    for v in vals:
        x.track(v)
    summary = x.to_summary()
    assert not summary.is_discrete
예제 #5
0
def test_one_value_not_discrete():
    x = NumberTracker()
    x.track(1)
    assert not x.to_summary().is_discrete