Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
e1e7b9e3
Commit
e1e7b9e3
authored
6 years ago
by
Enric Tejedor Saavedra
Browse files
Options
Downloads
Patches
Plain Diff
[Exp PyROOT] Add test for len in TCollection and subclasses
parent
b8221e84
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt
+3
-0
3 additions, 0 deletions
bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt
bindings/pyroot_experimental/PyROOT/test/tcollection_len.py
+31
-0
31 additions, 0 deletions
bindings/pyroot_experimental/PyROOT/test/tcollection_len.py
with
34 additions
and
0 deletions
bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt
+
3
−
0
View file @
e1e7b9e3
...
@@ -16,3 +16,6 @@ ROOT_ADD_PYUNITTEST(pyroot_pyz_ttree_setbranchaddress ttree_setbranchaddress.py
...
@@ -16,3 +16,6 @@ ROOT_ADD_PYUNITTEST(pyroot_pyz_ttree_setbranchaddress ttree_setbranchaddress.py
COPY_TO_BUILDDIR TreeHelper.h
)
COPY_TO_BUILDDIR TreeHelper.h
)
ROOT_ADD_PYUNITTEST
(
pyroot_pyz_ttree_branch ttree_branch.py
ROOT_ADD_PYUNITTEST
(
pyroot_pyz_ttree_branch ttree_branch.py
COPY_TO_BUILDDIR TreeHelper.h
)
COPY_TO_BUILDDIR TreeHelper.h
)
# TCollection and subclasses pythonizations
ROOT_ADD_PYUNITTEST
(
pyroot_pyz_tcollection_len tcollection_len.py
)
This diff is collapsed.
Click to expand it.
bindings/pyroot_experimental/PyROOT/test/tcollection_len.py
0 → 100644
+
31
−
0
View file @
e1e7b9e3
import
unittest
import
ROOT
class
TCollectionLen
(
unittest
.
TestCase
):
"""
Test for the pythonization that allows to access the number of elements of a
TCollection (or subclass) by calling `len` on it.
"""
num_elems
=
3
tobject_list
=
[
ROOT
.
TObject
()
for
_
in
range
(
num_elems
)
]
# Helpers
def
add_elems_check_len
(
self
,
c
):
for
elem
in
self
.
tobject_list
:
c
.
Add
(
elem
)
self
.
assertEqual
(
len
(
c
),
self
.
num_elems
)
self
.
assertEqual
(
len
(
c
),
c
.
GetEntries
())
# Tests
def
test_tlist
(
self
):
self
.
add_elems_check_len
(
ROOT
.
TList
())
def
test_tobjarray
(
self
):
self
.
add_elems_check_len
(
ROOT
.
TObjArray
())
def
test_thashtable
(
self
):
self
.
add_elems_check_len
(
ROOT
.
THashTable
())
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