test_tables.py 文件源码

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

项目:annotated-py-tinydb 作者: hhstore 项目源码 文件源码
def test_multiple_tables(db):
    table1 = db.table('table1')
    table2 = db.table('table2')
    table3 = db.table('table3')

    table1.insert({'int': 1, 'char': 'a'})
    table2.insert({'int': 1, 'char': 'b'})
    table3.insert({'int': 1, 'char': 'c'})

    assert table1.count(where('char') == 'a') == 1
    assert table2.count(where('char') == 'b') == 1
    assert table3.count(where('char') == 'c') == 1

    db.purge_tables()

    assert len(table1) == 0
    assert len(table2) == 0
    assert len(table3) == 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号