def test_operationalerror():
    cache = dc.FanoutCache('tmp', shards=1)

    shards = mock.Mock()
    shards.__getitem__ = mock.Mock(side_effect=sqlite3.OperationalError)

    object.__setattr__(cache, '_shards', shards)

    assert cache.set(0, 0) == False
    assert cache.get(0) == None
    assert (0 in cache) == False
    assert cache.__delitem__(0) == False

    shutil.rmtree('tmp')
dataset/ETHPy150Open grantjenks/python-diskcache/tests/test_fanout.py/test_operationalerror/original