Пример #1
0
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"}
Пример #2
0
def test_validate_label():
    col = Column(**minimal_schema.copy())
    with pytest.raises(ValueError):
        col.label = 4
Пример #3
0
def test_invalid_options():
    col = Column(**minimal_schema.copy())
    assert col.options is None
    with pytest.raises(ValueError):
        col.options = "Age"
Пример #4
0
def test_validate_type():
    col = Column(**minimal_schema.copy())
    with pytest.raises(ValueError):
        col.type = dict