test_storage.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:tableschema-pandas-py 作者: frictionlessdata 项目源码 文件源码
def test_storage_restore_schema_with_primary_key():
    data = [
        ('a',),
        ('b',),
    ]
    index = pd.Index([1, 2], name='key')
    df = pd.DataFrame(data, columns=('value',), index=index)
    storage = Storage(dataframes={'data': df})
    assert list(storage.read('data')) == [[1, 'a'], [2, 'b']]
    assert storage.describe('data') == {
        'primaryKey': 'key',
        'fields': [
            {'name': 'key', 'type': 'integer', 'constraints': {'required': True}},
            {'name': 'value', 'type': 'string'},
        ]
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号