Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions neo/io/nixio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,14 +1190,13 @@ def _nix_attr_to_neo(nix_obj):
values = ""
elif len(values) == 1:
values = values[0]
elif prop.definition == ARRAYANNOTATION:
if prop.definition == ARRAYANNOTATION:
if 'array_annotations' in neo_attrs:
neo_attrs['array_annotations'][prop.name] = values
else:
neo_attrs['array_annotations'] = {prop.name: values}
else:
values = list(values)
neo_attrs[prop.name] = values
neo_attrs[prop.name] = values
# since the 'neo_name' NIX property becomes the actual object's name,
# there's no reason to keep it in the annotations
neo_attrs["name"] = stringify(neo_attrs.pop("neo_name", None))
Expand Down
2 changes: 1 addition & 1 deletion neo/test/iotest/common_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def test_assert_readed_neo_object_is_compliant(self):
assert_neo_object_is_compliant(obj)
# intercept exceptions and add more information
except BaseException as exc:
exc.args += ('from %s' % os.path.basename(path))
exc.args += ('from %s' % os.path.basename(path), )
raise

def test_readed_with_lazy_is_compliant(self):
Expand Down
13 changes: 13 additions & 0 deletions neo/test/iotest/test_nixio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,19 @@ def test_array_annotations_read(self):
self.assertEqual(da.metadata.props['st_arr_ann'].unit,
units_to_string(neo_ann.units))

def test_read_blocks_are_writable(self):
filename = os.path.join(self.tempdir, "testnixio_out.nix")
writer = NixIO(filename, "ow")

blocks = self.io.read_all_blocks()

try:
writer.write_all_blocks(blocks)
except Exception as exc:
self.fail('The following exception was raised when'
+ ' writing the blocks loaded with NixIO:\n'
+ str(exc))


@unittest.skipUnless(HAVE_NIX, "Requires NIX")
class NixIOContextTests(NixIOTest):
Expand Down