Closed mpsonntag closed 2 years ago
the behaviour is odd in more than one way:
I would suggest to make sure that type is not empty and if name is not given, it is set to the id.
@achilleas-k is there a need to allow an empty type (in neo-nixio)
This is definitely a bug. The name and type should both be required. The check in the entity was for entities that don't have a name, which at some point was the Feature
class. Now though, all Entities have names and the Feature no longer subclasses Entity, so we should actually raise an error when either name or type are None or empty strings.
@jgrewe Need a confirmation for the above because my memory might be broken. Name and Type are required in NIX, right?
They should be required. Wasn't sure myself if we decided to allow empty types e.g. in the neo nix io for some reason I forgot... Will fix it. Thanks!
When creating a block and providing only the name, but not the type, the name value is ignored and the block name defaults to the blocks ID.
e.g.
b = nf.create_block(name="I-shall-be-ignored")
The corresponding lines responsible can be found in
block.py
andentity.py
:https://github.com/G-Node/nixpy/blob/c5ffc3b6b6d22b89433acffc9b96a6a0dacfe3e0/nixio/block.py#L55 https://github.com/G-Node/nixpy/blob/c5ffc3b6b6d22b89433acffc9b96a6a0dacfe3e0/nixio/entity.py#L23
Is this expected behavior and what would be the reason for ignoring a name value when the type has not been provided?