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

Fix tests

parent 9cb4b9d8
No related branches found
No related tags found
1 merge request!27Refactor offline I/O
...@@ -128,9 +128,9 @@ class TestOfflineReader(unittest.TestCase): ...@@ -128,9 +128,9 @@ class TestOfflineReader(unittest.TestCase):
# head is the supported format # head is the supported format
head = OFFLINE_NUMUCC.header head = OFFLINE_NUMUCC.header
self.assertEqual(float(head['DAQ']), 394) self.assertAlmostEqual(head.DAQ.livetime, 394)
self.assertEqual(float(head['kcut']), 2)
def test_warning_if_unsupported_header(self):
# test the warning for unsupported fheader format # test the warning for unsupported fheader format
with self.assertWarns(UserWarning): with self.assertWarns(UserWarning):
self.r.header self.r.header
...@@ -310,7 +310,7 @@ class TestUsr(unittest.TestCase): ...@@ -310,7 +310,7 @@ class TestUsr(unittest.TestCase):
self.f = OFFLINE_USR self.f = OFFLINE_USR
def test_str(self): def test_str(self):
print(self.f.usr) print(self.f.events.usr)
def test_nonexistent_usr(self): def test_nonexistent_usr(self):
f = OfflineReader(SAMPLES_DIR / "daq_v1.0.0.root") f = OfflineReader(SAMPLES_DIR / "daq_v1.0.0.root")
...@@ -323,20 +323,20 @@ class TestUsr(unittest.TestCase): ...@@ -323,20 +323,20 @@ class TestUsr(unittest.TestCase):
'LastPartPosZ', 'NSnapHits', 'NTrigHits', 'NTrigDOMs', 'LastPartPosZ', 'NSnapHits', 'NTrigHits', 'NTrigDOMs',
'NTrigLines', 'NSpeedVetoHits', 'NGeometryVetoHits', 'NTrigLines', 'NSpeedVetoHits', 'NGeometryVetoHits',
'ClassficationScore' 'ClassficationScore'
], self.f.usr.keys()) ], self.f.events.usr.keys())
def test_getitem(self): def test_getitem(self):
assert np.allclose( assert np.allclose(
[118.6302815337638, 44.33580521344907, 99.93916717621543], [118.6302815337638, 44.33580521344907, 99.93916717621543],
self.f.usr['CoC']) self.f.events.usr['CoC'])
assert np.allclose( assert np.allclose(
[37.51967774166617, -10.280346193553832, 13.67595659707355], [37.51967774166617, -10.280346193553832, 13.67595659707355],
self.f.usr['DeltaPosZ']) self.f.events.usr['DeltaPosZ'])
def test_attributes(self): def test_attributes(self):
assert np.allclose( assert np.allclose(
[118.6302815337638, 44.33580521344907, 99.93916717621543], [118.6302815337638, 44.33580521344907, 99.93916717621543],
self.f.usr.CoC) self.f.events.usr.CoC)
assert np.allclose( assert np.allclose(
[37.51967774166617, -10.280346193553832, 13.67595659707355], [37.51967774166617, -10.280346193553832, 13.67595659707355],
self.f.usr.DeltaPosZ) self.f.events.usr.DeltaPosZ)
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