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
43c8d08c
Commit
43c8d08c
authored
4 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Restructure tests
parent
d94b909f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#14113
passed with warnings
4 years ago
Stage: test
Stage: coverage
Stage: doc
Stage: release
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3io/tools.py
+1
-1
1 addition, 1 deletion
km3io/tools.py
tests/test_tools.py
+7
-8
7 additions, 8 deletions
tests/test_tools.py
with
8 additions
and
9 deletions
km3io/tools.py
+
1
−
1
View file @
43c8d08c
...
...
@@ -316,7 +316,7 @@ def best_track(tracks, strategy="default", rec_type=None):
out
=
tracks
[:,
0
]
if
strategy
==
"
default
"
and
rec_type
is
None
:
raise
Key
Error
(
raise
Value
Error
(
"
rec_type must be provided when the default strategy is used.
"
)
if
strategy
==
"
default
"
and
rec_type
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_tools.py
+
7
−
8
View file @
43c8d08c
...
...
@@ -58,8 +58,7 @@ class TestBestTrack(unittest.TestCase):
self
.
events
=
OFFLINE_FILE
.
events
self
.
one_event
=
OFFLINE_FILE
.
events
[
0
]
def
test_best_tracks
(
self
):
# test selection from multiple events
def
test_best_track_from_multiple_events
(
self
):
events
=
self
.
events
[
self
.
events
.
n_tracks
>
0
]
first_tracks
=
best_track
(
events
.
tracks
,
strategy
=
"
first
"
)
default_best
=
best_track
(
events
.
tracks
,
...
...
@@ -73,7 +72,7 @@ class TestBestTrack(unittest.TestCase):
assert
default_best
.
lik
[
1
]
==
ak
.
max
(
events
.
tracks
.
lik
[
1
])
assert
default_best
.
rec_type
[
0
]
==
4000
# test selection from one event
def
test_best_track_from_a_single_event
(
self
):
first_track
=
best_track
(
self
.
one_event
.
tracks
,
strategy
=
"
first
"
)
best
=
best_track
(
self
.
one_event
.
tracks
,
strategy
=
"
default
"
,
...
...
@@ -85,13 +84,13 @@ class TestBestTrack(unittest.TestCase):
assert
best
.
lik
==
ak
.
max
(
self
.
one_event
.
tracks
.
lik
)
assert
best
.
rec_type
==
4000
# test raising ValueError
def
test_best_track_raises_when_unknown_strategy
(
self
):
with
self
.
assertRaises
(
ValueError
):
best_track
(
events
.
tracks
,
strategy
=
"
Zineb
"
)
best_track
(
self
.
events
.
tracks
,
strategy
=
"
Zineb
"
)
# test raising KeyError
with
self
.
assertRaises
(
Key
Error
):
best_track
(
events
.
tracks
)
def
test_best_track_raises_when_default_strategy_and_no_rectype
(
self
):
with
self
.
assertRaises
(
Value
Error
):
best_track
(
self
.
events
.
tracks
)
class
TestGetMultiplicity
(
unittest
.
TestCase
):
...
...
This diff is collapsed.
Click to expand it.
Tamas Gal
@tgal
mentioned in issue
#39 (closed)
·
4 years ago
mentioned in issue
#39 (closed)
mentioned in issue #39
Toggle commit list
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