diff --git a/km3io/tools.py b/km3io/tools.py index 22bf1e64ab43ce233dd0d50a4fd47a51af4b24a7..045c0cb9f9c1daea57ee616aaf4aa08a4eeab39a 100644 --- a/km3io/tools.py +++ b/km3io/tools.py @@ -306,7 +306,7 @@ def best_track(events, strategy="default", rec_type=None, rec_stages=None): raise ValueError("{} not in {}".format(strategy, options)) n_events = len(events) - if n_events>1 and any(events.n_tracks == 0): + if n_events > 1 and any(events.n_tracks == 0): raise ValueError( "'events' should not contain empty tracks. Consider applying the mask: events.n_tracks>0" ) diff --git a/tests/test_tools.py b/tests/test_tools.py index 17f1fd1aee6f490980a9782dabd35a036530e816..05dd386eb69a1ca5454b483f42df62d93e6e142c 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -8,7 +8,8 @@ from pathlib import Path from km3io import OfflineReader from km3io.tools import (to_num, cached_property, unfold_indices, unique, uniquecount, fitinf, fitparams, count_nested, _find, - mask, best_track, rec_types, get_w2list_param, get_multiplicity) + mask, best_track, rec_types, get_w2list_param, + get_multiplicity) SAMPLES_DIR = Path(__file__).parent / 'samples' OFFLINE_FILE = OfflineReader(SAMPLES_DIR / 'km3net_offline.root') @@ -90,11 +91,13 @@ class TestBestTrack(unittest.TestCase): class TestGetMultiplicity(unittest.TestCase): def test_get_multiplicity(self): - rec_stages_tracks = get_multiplicity(OFFLINE_FILE.events.tracks, [1, 3, 5, 4]) + rec_stages_tracks = get_multiplicity(OFFLINE_FILE.events.tracks, + [1, 3, 5, 4]) assert rec_stages_tracks.rec_stages[0] == [1, 3, 5, 4] assert rec_stages_tracks.rec_stages[1] == [1, 3, 5, 4] + class TestCountNested(unittest.TestCase): def test_count_nested(self): fit = OFFLINE_FILE.events.tracks.fitinf