Skip to content
Snippets Groups Projects
Commit 79839244 authored by Enric Tejedor Saavedra's avatar Enric Tejedor Saavedra
Browse files

[Exp PyROOT] Add test for len in TArray and subclasses

parent 2fbb49db
No related branches found
No related tags found
No related merge requests found
......@@ -19,3 +19,6 @@ ROOT_ADD_PYUNITTEST(pyroot_pyz_ttree_branch ttree_branch.py
# TCollection and subclasses pythonizations
ROOT_ADD_PYUNITTEST(pyroot_pyz_tcollection_len tcollection_len.py)
# TArray and subclasses pythonizations
ROOT_ADD_PYUNITTEST(pyroot_pyz_tarray_len tarray_len.py)
import unittest
import ROOT
class TArrayLen(unittest.TestCase):
"""
Test for the pythonization that allows to access the number of elements of a
TArray (or subclass) by calling `len` on it.
"""
num_elems = 3
# Helpers
def check_len(self, a):
self.assertEqual(len(a), self.num_elems)
self.assertEqual(len(a), a.GetSize())
# Tests
def test_tarrayi(self):
self.check_len(ROOT.TArrayI(self.num_elems))
def test_tarrayd(self):
self.check_len(ROOT.TArrayD(self.num_elems))
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