File tree Expand file tree Collapse file tree
bindings/pyroot/pythonizations/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ ROOT_ADD_PYUNITTEST(pyroot_pyz_decorator pythonization_decorator.py)
2626ROOT_ADD_PYUNITTEST (pyroot_pyz_pretty_printing pretty_printing.py )
2727ROOT_ADD_PYUNITTEST (pyroot_pyz_array_interface array_interface.py PYTHON_DEPS numpy )
2828
29+ # STL vector pythonizations
30+ ROOT_ADD_PYUNITTEST (pyroot_pyz_stl_vector stl_vector.py )
31+
2932# TObject and subclasses pythonisations
3033ROOT_ADD_PYUNITTEST (pyroot_pyz_tobject_contains tobject_contains.py )
3134ROOT_ADD_PYUNITTEST (pyroot_pyz_tobject_comparisonops tobject_comparisonops.py )
Original file line number Diff line number Diff line change 1+ import unittest
2+ import ROOT
3+
4+
5+ class STL_vector (unittest .TestCase ):
6+ """
7+ Tests for the pythonizations of std::vector.
8+ """
9+
10+ def test_vec_char_data (self ):
11+ '''
12+ Test that calling std::vector<char>::data() returns a Python string
13+ that contains the characters of the vector and no exception is raised.
14+ Check also that the iteration over the vector runs normally (#9632).
15+ '''
16+
17+ elems = ['a' ,'b' ,'c' ]
18+ v = ROOT .std .vector ['char' ](elems )
19+ self .assertEqual (v .data (), '' .join (elems ))
20+
21+ for elem in v :
22+ self .assertEqual (elem , elems .pop (0 ))
23+
24+ if __name__ == '__main__' :
25+ unittest .main ()
You can’t perform that action at this time.
0 commit comments