test_tables.py 文件源码

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

项目:minihydra 作者: VillanCh 项目源码 文件源码
def test_lru_cache(db):
    # Test integration into TinyDB
    table = db.table('table3', cache_size=2)
    query = where('int') == 1

    table.search(query)
    table.search(where('int') == 2)
    table.search(where('int') == 3)
    assert query not in table._query_cache

    table.remove(where('int') == 1)
    assert not table._query_cache.lru

    table.search(query)

    assert len(table._query_cache) == 1
    table.clear_cache()
    assert len(table._query_cache) == 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号