|
|
@@ -49,10 +49,16 @@ class TestBulkData(object): |
|
|
|
nodes.append(data.getnode("/foo/baz/quux")) |
|
|
|
del nodes |
|
|
|
|
|
|
|
def get_node_slice(key): |
|
|
|
if isinstance(key, slice): |
|
|
|
return [ node.get_data(x, x+1) for x in |
|
|
|
xrange(*key.indices(node.nrows)) ] |
|
|
|
return node.get_data(key, key+1) |
|
|
|
|
|
|
|
# Test node |
|
|
|
node = data.getnode("/foo/bar") |
|
|
|
with assert_raises(IndexError): |
|
|
|
x = node[0] |
|
|
|
x = get_node_slice(0) |
|
|
|
raw = [] |
|
|
|
for i in range(1000): |
|
|
|
raw.append("%d 1 2 3 4 5 6 7 8\n" % (10000 + i)) |
|
|
@@ -67,14 +73,14 @@ class TestBulkData(object): |
|
|
|
|
|
|
|
# Extract slices |
|
|
|
for s in misc_slices: |
|
|
|
eq_(node[s], raw[s]) |
|
|
|
eq_(get_node_slice(s), raw[s]) |
|
|
|
|
|
|
|
# Extract misc slices while appending, to make sure the |
|
|
|
# data isn't being added in the middle of the file |
|
|
|
for s in [2, slice(1,5), 2, slice(1,5)]: |
|
|
|
node.append_string("0 0 0 0 0 0 0 0 0\n", 0, 50000) |
|
|
|
raw.append("0 0 0 0 0 0 0 0 0\n") |
|
|
|
eq_(node[s], raw[s]) |
|
|
|
eq_(get_node_slice(s), raw[s]) |
|
|
|
|
|
|
|
# Get some coverage of remove; remove is more fully tested |
|
|
|
# in cmdline |
|
|
@@ -92,7 +98,7 @@ class TestBulkData(object): |
|
|
|
|
|
|
|
# Extract slices |
|
|
|
for s in misc_slices: |
|
|
|
eq_(node[s], raw[s]) |
|
|
|
eq_(get_node_slice(s), raw[s]) |
|
|
|
|
|
|
|
# destroy |
|
|
|
with assert_raises(ValueError): |
|
|
|