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

Commit 18bbbf8

Browse files
author
Dominik Neise
committed
Merge branch 'master' into tidy_up_tests_more_tests
2 parents f6af367 + 341b431 commit 18bbbf8

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
21
import numpy as np
32
import pkg_resources
43
import os
54

5+
from protozfits import SimpleFile
6+
67
example_file_path = pkg_resources.resource_filename(
78
'protozfits',
89
os.path.join(
@@ -13,20 +14,16 @@
1314
)
1415

1516

16-
def test_can_open_file():
17-
from protozfits import SimpleFile
18-
SimpleFile(example_file_path)
19-
20-
2117
def test_can_iterate_over_events_and_run_header():
22-
from protozfits import SimpleFile
23-
f = SimpleFile(example_file_path)
2418

25-
camera_config = next(f.CameraConfig)
26-
assert (camera_config.expected_pixels_id == np.arange(14)).all()
19+
with SimpleFile(example_file_path) as f:
20+
21+
camera_config = next(f.CameraConfig)
22+
assert (camera_config.expected_pixels_id == np.arange(14)).all()
2723

28-
for event in f.Events:
29-
assert event.waveform.shape == (1120,)
30-
assert event.pixel_status.shape == (14,)
31-
assert event.lstcam.first_capacitor_id.shape == (16,)
32-
assert event.lstcam.counters.shape == (44,)
24+
for i, event in enumerate(f.Events):
25+
assert event.event_id == i + 1
26+
assert event.waveform.shape == (1120,)
27+
assert event.pixel_status.shape == (14,)
28+
assert event.lstcam.first_capacitor_id.shape == (16,)
29+
assert event.lstcam.counters.shape == (44,)

0 commit comments

Comments
 (0)