diff --git a/neo/io/nixio.py b/neo/io/nixio.py index d6302be3c..e04c87542 100644 --- a/neo/io/nixio.py +++ b/neo/io/nixio.py @@ -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)) diff --git a/neo/test/iotest/common_io_test.py b/neo/test/iotest/common_io_test.py index 02f739f4f..7f7987314 100644 --- a/neo/test/iotest/common_io_test.py +++ b/neo/test/iotest/common_io_test.py @@ -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): diff --git a/neo/test/iotest/test_nixio.py b/neo/test/iotest/test_nixio.py index 2913bf17e..c2de2c48f 100644 --- a/neo/test/iotest/test_nixio.py +++ b/neo/test/iotest/test_nixio.py @@ -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):