Skip to content
Snippets Groups Projects
Commit b7bd80e5 authored by Stefan Wunsch's avatar Stefan Wunsch Committed by Enric Tejedor
Browse files

[PyROOT experimental] Add tests for ROOT module

parent 52882d38
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
# For the licensing terms see $ROOTSYS/LICENSE. # For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS. # For the list of contributors see $ROOTSYS/README/CREDITS.
# Test ROOT module
ROOT_ADD_PYUNITTEST(pyroot_root_module root_module.py)
# General pythonizations # General pythonizations
ROOT_ADD_PYUNITTEST(pyroot_pyz_pretty_printing pretty_printing.py) ROOT_ADD_PYUNITTEST(pyroot_pyz_pretty_printing pretty_printing.py)
ROOT_ADD_PYUNITTEST(pyroot_pyz_array_interface array_interface.py) ROOT_ADD_PYUNITTEST(pyroot_pyz_array_interface array_interface.py)
......
import unittest
class ROOTModule(unittest.TestCase):
"""
Testing features of the ROOT module implemented in the ROOT module facade
"""
def test_import(self):
"""
Test import
"""
import ROOT
self.assertEqual(ROOT.__name__, "ROOT")
def test_relative_import(self):
"""
Test relative import
"""
from ROOT import TH1F
self.assertEqual(TH1F.__name__, "TH1F")
from ROOT import TH1F as Foo
self.assertEqual(Foo.__name__, "TH1F")
self.assertEqual(TH1F, Foo)
def test_version(self):
"""
Test __version__ property
"""
import ROOT
v = ROOT.__version__
self.assertTrue(type(v) == str)
self.assertIn("/", v)
self.assertIn(".", v)
self.assertEqual(v, ROOT.gROOT.GetVersion())
def test_ignore_cmdline_options(self):
"""
Test module flag to ignore command line options
"""
import ROOT
self.assertEqual(ROOT.PyConfig.IgnoreCommandLineOptions, False)
ROOT.PyConfig.IgnoreCommandLineOptions = True
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