Skip to content
Snippets Groups Projects
Commit 70d3cf6a authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Deactivate iteration which was not implemented anyways

parent bda704e4
No related branches found
No related tags found
No related merge requests found
......@@ -354,6 +354,13 @@ class Branch:
return unfold_indices(self._branch[key].array(), self._index_chain)
def __iter__(self):
raise NotImplementedError(
"iterating over a nested branch is not supported nor recommended. "
"If you really feel you need to do it, open an issue in "
"https://git.km3net.de/km3py/km3io"
)
def __getitem__(self, key):
return self.__class__(
self._branch, self.fields, self._aliases, self._index_chain + [key]
......
......@@ -235,6 +235,10 @@ class TestOfflineEvents(unittest.TestCase):
with self.assertRaises(NotImplementedError):
[e.id for e in self.events[2:8][2:4]]
def test_iteration_over_subbranches_raises(self):
with self.assertRaises(NotImplementedError):
[t for t in self.events[0].tracks]
def test_str(self):
assert str(self.n_events) in str(self.events)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment