def test_encode_column():
    from gviz_data_table.column import Column
    schema = Column(id='age', type=int)
    js = encode(schema)
    python = json.loads(js)
    assert python == {"type": "number", "id": "age", "label": "age"}
Example #2
0
def test_validate_label():
    col = Column(**minimal_schema.copy())
    with pytest.raises(ValueError):
        col.label = 4
Example #3
0
def test_invalid_options():
    col = Column(**minimal_schema.copy())
    assert col.options is None
    with pytest.raises(ValueError):
        col.options = "Age"
Example #4
0
def test_validate_type():
    col = Column(**minimal_schema.copy())
    with pytest.raises(ValueError):
        col.type = dict