This looks cool, but is really strange. In the first line section l2n2 is deleted, and in the last line we ask whether it exists. Section::hasSection(section) does return backend()->hasSection(section.id()); looks ok, but in this context it should fail! We deleted l2n2 from the file. The l2n2 variable, is not None, however. The strange thing is, that we can ask for its name, or id and get proper results, even though it was deleted just moments before. Why is this possible? Probably because hdf5 caches or does not flush between the two lines in the code. The previous test fails in the file-backend because l2n2 does no longer exist.
Imho, the hasSection(), and probably all other hasXYZ() functions should be changed to catch the possibility that the entity has been deleted but is not none. I do not like try catch statements that much, but it would be one option.
I found the following code in the tests:
This looks cool, but is really strange. In the first line section l2n2 is deleted, and in the last line we ask whether it exists.
Section::hasSection(section)
doesreturn backend()->hasSection(section.id());
looks ok, but in this context it should fail! We deleted l2n2 from the file. The l2n2 variable, is not None, however. The strange thing is, that we can ask for its name, or id and get proper results, even though it was deleted just moments before. Why is this possible? Probably because hdf5 caches or does not flush between the two lines in the code. The previous test fails in the file-backend because l2n2 does no longer exist.Imho, the
hasSection()
, and probably all otherhasXYZ()
functions should be changed to catch the possibility that the entity has been deleted but is not none. I do not like try catch statements that much, but it would be one option.