Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
add test regarding event_ids and close files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Neise committed May 11, 2018
1 parent 9682115 commit d6d26aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion protozfits/tests/test_R1_example_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

def test_can_open_file():
from protozfits import SimpleFile
SimpleFile(example_file_path)
f = SimpleFile(example_file_path)
f.close()


def test_can_iterate_over_events_and_run_header():
Expand All @@ -30,3 +31,11 @@ def test_can_iterate_over_events_and_run_header():
assert event.pixel_status.shape == (14,)
assert event.lstcam.first_capacitor_id.shape == (16,)
assert event.lstcam.counters.shape == (44,)
f.close()

def test_event_ids():
from protozfits import SimpleFile
with SimpleFile(example_file_path) as f:
event_ids = [e.event_id for e in f.Events]

assert (np.array(event_ids) == 1 + np.arange(len(event_ids))).all()

0 comments on commit d6d26aa

Please sign in to comment.