Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
km3py
km3io
Commits
9cb4b9d8
Commit
9cb4b9d8
authored
5 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Massive test runner speedup
parent
828ab2e8
No related branches found
No related tags found
1 merge request
!27
Refactor offline I/O
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_offline.py
+12
-12
12 additions, 12 deletions
tests/test_offline.py
with
12 additions
and
12 deletions
tests/test_offline.py
+
12
−
12
View file @
9cb4b9d8
...
...
@@ -5,15 +5,15 @@ from pathlib import Path
from
km3io
import
OfflineReader
SAMPLES_DIR
=
Path
(
__file__
).
parent
/
'
samples
'
OFFLINE_FILE
=
SAMPLES_DIR
/
'
aanet_v2.0.0.root
'
OFFLINE_USR
=
SAMPLES_DIR
/
'
usr-sample.root
'
OFFLINE_NUMUCC
=
SAMPLES_DIR
/
"
numucc.root
"
# with mc data
OFFLINE_FILE
=
OfflineReader
(
SAMPLES_DIR
/
'
aanet_v2.0.0.root
'
)
OFFLINE_USR
=
OfflineReader
(
SAMPLES_DIR
/
'
usr-sample.root
'
)
OFFLINE_NUMUCC
=
OfflineReader
(
SAMPLES_DIR
/
"
numucc.root
"
)
# with mc data
class
TestOfflineReader
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
r
=
OfflineReader
(
OFFLINE_FILE
)
self
.
nu
=
OfflineReader
(
OFFLINE_NUMUCC
)
self
.
r
=
OFFLINE_FILE
self
.
nu
=
OFFLINE_NUMUCC
self
.
Nevents
=
10
def
test_number_events
(
self
):
...
...
@@ -126,7 +126,7 @@ class TestOfflineReader(unittest.TestCase):
def
test_reading_header
(
self
):
# head is the supported format
head
=
OfflineReader
(
OFFLINE_NUMUCC
)
.
header
head
=
OFFLINE_NUMUCC
.
header
self
.
assertEqual
(
float
(
head
[
'
DAQ
'
]),
394
)
self
.
assertEqual
(
float
(
head
[
'
kcut
'
]),
2
)
...
...
@@ -138,7 +138,7 @@ class TestOfflineReader(unittest.TestCase):
class
TestOfflineEvents
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
events
=
OfflineReader
(
OFFLINE_FILE
)
.
events
self
.
events
=
OFFLINE_FILE
.
events
self
.
n_events
=
10
self
.
det_id
=
[
44
]
*
self
.
n_events
self
.
n_hits
=
[
176
,
125
,
318
,
157
,
83
,
60
,
71
,
84
,
255
,
105
]
...
...
@@ -191,7 +191,7 @@ class TestOfflineEvents(unittest.TestCase):
class
TestOfflineHits
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
hits
=
OfflineReader
(
OFFLINE_FILE
)
.
hits
self
.
hits
=
OFFLINE_FILE
.
hits
self
.
n_hits
=
10
self
.
dom_id
=
{
0
:
[
...
...
@@ -239,8 +239,8 @@ class TestOfflineHits(unittest.TestCase):
class
TestOfflineTracks
(
unittest
.
TestCase
):
@unittest.skip
def
setUp
(
self
):
self
.
tracks
=
OfflineReader
(
OFFLINE_FILE
)
.
tracks
self
.
r_mc
=
OfflineReader
(
OFFLINE_NUMUCC
)
self
.
tracks
=
OFFLINE_FILE
.
tracks
self
.
r_mc
=
OFFLINE_NUMUCC
self
.
Nevents
=
10
@unittest.skip
...
...
@@ -307,14 +307,14 @@ class TestOfflineTracks(unittest.TestCase):
class
TestUsr
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
f
=
OfflineReader
(
OFFLINE_USR
)
self
.
f
=
OFFLINE_USR
def
test_str
(
self
):
print
(
self
.
f
.
usr
)
def
test_nonexistent_usr
(
self
):
f
=
OfflineReader
(
SAMPLES_DIR
/
"
daq_v1.0.0.root
"
)
self
.
assert
ListEqual
([],
f
.
usr
.
keys
()
)
assert
not
hasattr
(
self
.
f
,
"
usr
"
)
def
test_keys
(
self
):
self
.
assertListEqual
([
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment