diff --git a/bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt b/bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt index ef67512c93db7a52068c27efc62df4434cb39374..e886c5bbb5cd3f3b9e52d4a7648c0c751a66657a 100644 --- a/bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt +++ b/bindings/pyroot_experimental/PyROOT/test/CMakeLists.txt @@ -4,6 +4,9 @@ # For the licensing terms see $ROOTSYS/LICENSE. # For the list of contributors see $ROOTSYS/README/CREDITS. +# Test ROOT module +ROOT_ADD_PYUNITTEST(pyroot_root_module root_module.py) + # General pythonizations ROOT_ADD_PYUNITTEST(pyroot_pyz_pretty_printing pretty_printing.py) ROOT_ADD_PYUNITTEST(pyroot_pyz_array_interface array_interface.py) diff --git a/bindings/pyroot_experimental/PyROOT/test/root_module.py b/bindings/pyroot_experimental/PyROOT/test/root_module.py new file mode 100644 index 0000000000000000000000000000000000000000..b15df78a6f68aeb369cd6765b404457bd9b72f91 --- /dev/null +++ b/bindings/pyroot_experimental/PyROOT/test/root_module.py @@ -0,0 +1,46 @@ +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