Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LHCb
Analysis
Commits
5ad877e2
Commit
5ad877e2
authored
2 years ago
by
Eduardo Rodrigues
Committed by
Patrick Koppenburg
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Full coverage in FunTuple Python modules
parent
5e25c304
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!915
Full coverage in FunTuple Python modules
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Phys/FunTuple/tests/test_FunctorCollection.py
+5
-0
5 additions, 0 deletions
Phys/FunTuple/tests/test_FunctorCollection.py
Phys/FunTuple/tests/test_functions.py
+30
-2
30 additions, 2 deletions
Phys/FunTuple/tests/test_functions.py
with
35 additions
and
2 deletions
Phys/FunTuple/tests/test_FunctorCollection.py
+
5
−
0
View file @
5ad877e2
...
...
@@ -54,6 +54,11 @@ def test_constructor_TypeError_dict_keys():
_
=
FunctorCollection
({(
1
,
):
"
CHILD(PT, 1)
"
,
"
PT
"
:
F
.
PT
})
def
test_constructor_TypeError_bad_functor_type
():
with
pytest
.
raises
(
TypeError
):
_
=
FunctorCollection
({
"
BadType
"
:
lambda
x
:
x
**
2
})
def
test_repr_thor
():
c
=
FunctorCollection
({
"
PT
"
:
F
.
PT
})
assert
repr
(
c
)
==
"
<FunctorCollection: n_thor_fctors=1, n_loki_fctors=0>
"
...
...
This diff is collapsed.
Click to expand it.
Phys/FunTuple/tests/test_functions.py
+
30
−
2
View file @
5ad877e2
...
...
@@ -13,10 +13,11 @@ import sys
import
pytest
from
PyConf.application
import
make_data_with_FetchDataFromFile
from
PyConf.application
import
default_raw_event
,
make_odin
import
Functors
as
F
from
FunTuple
import
FunctorCollection
from
FunTuple.functorcollections
import
Kinematics
from
FunTuple.functorcollections
import
Kinematics
,
EventInfo
@pytest.fixture
()
...
...
@@ -36,7 +37,10 @@ variables = dict(A=Kinematics())
# to test both FunTuple_Particles and FunTuple_MCParticles
# available in the FunTuple module
list_function_tuple_name
=
((
"
FunTuple_Particles
"
,
"
FunTupleP
"
),
(
"
FunTuple_MCParticles
"
,
"
FunTupleMCP
"
))
(
"
FunTuple_MCParticles
"
,
"
FunTupleMCP
"
),
(
"
FunTuple_Composites
"
,
"
FunTupleComposites
"
),
(
"
FunTuple_ChargedBasics
"
,
"
FunTupleChgBasics
"
))
this_module
=
sys
.
modules
[
"
FunTuple
"
]
...
...
@@ -112,6 +116,30 @@ def test_simple_with_ALL_field(data_handle, func_name, name_argument):
inputs
=
data_handle
)
@pytest.mark.parametrize
(
"
func_name,name_argument
"
,
list_function_tuple_name
)
def
test_with_event_variables
(
data_handle
,
func_name
,
name_argument
):
"""
Check that event variables passed as an optional argument are dealt with correctly.
"""
with
default_raw_event
.
bind
(
raw_event_format
=
0.5
):
odin_loc
=
make_odin
(
stream
=
"
Spruce
"
)
event_variables
=
EventInfo
(
odin_loc
,
extra_info
=
True
)
tuple
=
getattr
(
this_module
,
func_name
)(
name
=
name_argument
,
tuple_name
=
name_argument
,
fields
=
fields
,
variables
=
variables
,
event_variables
=
event_variables
,
inputs
=
data_handle
)
assert
list
(
tuple
.
properties
[
"
void_thor_functors
"
].
keys
())
==
[
"
EVENTNUMBER
"
,
"
RUNNUMBER
"
,
"
BUNCHCROSSING_ID
"
,
"
BUNCHCROSSING_TYPE
"
,
"
ODINTCK
"
,
"
GPSTIME
"
]
@pytest.mark.parametrize
(
"
func_name,name_argument
"
,
list_function_tuple_name
)
def
test_with_loki_preamble
(
data_handle
,
func_name
,
name_argument
):
"""
...
...
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