def test_simple(hdfs): mw = HDFSMap(hdfs, root) mw.clear() assert not mw assert list(mw) == list(mw.keys()) == [] assert list(mw.values()) == [] assert list(mw.items()) == []
def test_with_data(hdfs): mw = HDFSMap(hdfs, root) mw['x'] = b'123' assert list(mw) == list(mw.keys()) == ['x'] assert list(mw.values()) == [b'123'] assert list(mw.items()) == [('x', b'123')] assert mw['x'] == b'123' assert bool(mw) assert set(hdfs.walk(root)) == {root + '/x', root} mw['x'] = b'000' assert mw['x'] == b'000' mw['y'] = b'456' assert mw['y'] == b'456' assert set(mw) == {'x', 'y'} mw.clear() assert list(mw) == []
def test_with_data(hdfs): mw = HDFSMap(hdfs, root) mw['x'] = b'123' assert list(mw) == list(mw.keys()) == ['x'] assert list(mw.values()) == [b'123'] assert list(mw.items()) == [('x', b'123')] assert mw['x'] == b'123' assert bool(mw) assert set(hdfs.walk(root)) == {root+'/x', root} mw['x'] = b'000' assert mw['x'] == b'000' mw['y'] = b'456' assert mw['y'] == b'456' assert set(mw) == {'x', 'y'} mw.clear() assert list(mw) == []