Esempio n. 1
0
def test_schema_repr_empty():
    schema = TableSchema([], {})
    assert repr(
        schema
    ) == 'Empty DataFrame\nColumns: [Logical Type, Semantic Tag(s)]\nIndex: []'

    assert schema._repr_html_(
    ) == '<table border="1" class="dataframe">\n  <thead>\n    <tr style="text-align: right;">\n      <th></th>\n      <th>Logical Type</th>\n      <th>Semantic Tag(s)</th>\n    </tr>\n    <tr>\n      <th>Column</th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n  </tbody>\n</table>'
Esempio n. 2
0
def test_schema_repr(small_df):
    schema = TableSchema(list(small_df.columns),
                         logical_types={"sample_datetime_series": Datetime})

    schema_repr = repr(schema)
    expected_repr = "                       Logical Type Semantic Tag(s)\nColumn                                             \nsample_datetime_series     Datetime              []"
    assert schema_repr == expected_repr

    schema_html_repr = schema._repr_html_()
    expected_repr = '<table border="1" class="dataframe">\n  <thead>\n    <tr style="text-align: right;">\n      <th></th>\n      <th>Logical Type</th>\n      <th>Semantic Tag(s)</th>\n    </tr>\n    <tr>\n      <th>Column</th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>sample_datetime_series</th>\n      <td>Datetime</td>\n      <td>[]</td>\n    </tr>\n  </tbody>\n</table>'
    assert schema_html_repr == expected_repr