예제 #1
0
def test_track_datatype_counts():
    type_counts = {
        Type.INTEGRAL: 2,
        Type.STRING: 2,
        Type.FRACTIONAL: 2,
        Type.BOOLEAN: 2,
        Type.UNKNOWN: 2,
    }
    tracker = SchemaTracker()
    multiple_track(tracker, type_counts)

    assert type_counts[Type.INTEGRAL] == tracker.get_count(Type.INTEGRAL)
    assert type_counts[Type.STRING] == tracker.get_count(Type.STRING)
    assert type_counts[Type.FRACTIONAL] == tracker.get_count(Type.FRACTIONAL)
    assert type_counts[Type.BOOLEAN] == tracker.get_count(Type.BOOLEAN)
    assert type_counts[Type.UNKNOWN] == tracker.get_count(Type.UNKNOWN)
예제 #2
0
def test_round_trip_with_legacy():
    type_counts = {
        Type.INTEGRAL: 3,
        Type.STRING: 4,
        Type.FRACTIONAL: 5,
        Type.BOOLEAN: 6,
        Type.UNKNOWN: 1,
    }
    tracker = SchemaTracker(type_counts, legacy_null_count=1)
    assert tracker.get_count(Type.NULL) == 1