示例#1
0
def test_map_clear_empty(token_restore):
    with gcs_maker() as gcs:
        d = gcs.get_mapper(root)
        d.clear()
        assert list(d) == []
        d[1] = b'1'
        assert list(d) == ['1']
        d.clear()
        assert list(d) == []
示例#2
0
def test_map_clear_empty(token_restore):
    with gcs_maker() as gcs:
        d = GCSMap(root, gcs)
        d.clear()
        assert list(d) == []
        d[1] = b'1'
        assert list(d) == ['1']
        d.clear()
        assert list(d) == []
示例#3
0
def test_map_with_data(token_restore):
    with gcs_maker() as gcs:
        d = gcs.get_mapper(root)
        d['x'] = b'123'
        assert list(d) == list(d.keys()) == ['x']
        assert list(d.values()) == [b'123']
        assert list(d.items()) == [('x', b'123')]
        assert d['x'] == b'123'
        assert bool(d)

        assert gcs.find(root) == [TEST_BUCKET+'/mapping/x']
        d['x'] = b'000'
        assert d['x'] == b'000'

        d['y'] = b'456'
        assert d['y'] == b'456'
        assert set(d) == {'x', 'y'}

        d.clear()
        assert list(d) == []