diff --git a/km3io/offline.py b/km3io/offline.py index 4ef4470c8a9e845ea778ec18dd2eabd43d19b8d6..3a04e793af707062eb24364410e86b99c865403f 100644 --- a/km3io/offline.py +++ b/km3io/offline.py @@ -137,6 +137,8 @@ class Usr: basketcache=BASKET_CACHE)[0] ] except (KeyError, IndexError): # e.g. old aanet files + print("The `usr` fields could not be parsed for the '{}' branch." + .format(name)) self._usr_names = [] else: self._usr_idx_lookup = { diff --git a/tests/test_offline.py b/tests/test_offline.py index 1d5229a1df8dbf66666c7523dee06ad057bcf455..0001a252f2dec6ff66596cf551f3d8cc397dce06 100644 --- a/tests/test_offline.py +++ b/tests/test_offline.py @@ -173,53 +173,20 @@ class TestOfflineHits(unittest.TestCase): class TestOfflineTracks(unittest.TestCase): def setUp(self): self.tracks = OFFLINE_FILE.events.tracks - self.r_mc = OFFLINE_NUMUCC - self.Nevents = 10 + self.tracks_numucc = OFFLINE_NUMUCC + self.n_events = 10 + + def test_attributes_available(self): + for key in self.tracks._keymap.keys(): + getattr(self.tracks, key) - @unittest.skip def test_item_selection(self): self.assertListEqual(list(self.tracks[0].dir_z[:2]), [-0.872885221293917, -0.872885221293917]) - @unittest.skip - def test_IndexError(self): - # test handling IndexError with empty lists/arrays - self.assertEqual(len(OfflineTracks(['whatever'], [])), 0) - - @unittest.skip def test_repr(self): assert " 10 " in repr(self.tracks) - @unittest.skip - def test_str(self): - assert str(self.tracks).endswith(" 10") - - @unittest.skip - def test_reading_tracks_dir_z(self): - dir_z = self.tracks.dir_z - tracks_dir_z = {0: 56, 1: 55, 8: 54} - - for track_id, n_dir in tracks_dir_z.items(): - self.assertEqual(n_dir, len(dir_z[track_id])) - - # check that there are 10 arrays of tracks.dir_z info - self.assertEqual(len(dir_z), self.Nevents) - - @unittest.skip - def test_reading_mc_tracks_dir_z(self): - dir_z = self.r_mc.mc_tracks.dir_z - tracks_dir_z = {0: 11, 1: 25, 8: 13} - - for track_id, n_dir in tracks_dir_z.items(): - self.assertEqual(n_dir, len(dir_z[track_id])) - - # check that there are 10 arrays of tracks.dir_z info - self.assertEqual(len(dir_z), self.Nevents) - - self.assertListEqual([0.230189, 0.230189, 0.218663], - list(dir_z[0][:3])) - - @unittest.skip def test_slicing(self): tracks = self.tracks assert 10 == len(tracks)