Skip to content

Commit

Permalink
[df] Add Python test with empty list of filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
vepadulano committed Jan 31, 2025
1 parent fb679bf commit b4bc365
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bindings/pyroot/pythonizations/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ endif()
# RDFDescription pythonization
if (dataframe)
ROOT_ADD_PYUNITTEST(pyroot_rdfdescription rdfdescription.py)

ROOT_ADD_PYUNITTEST(pyroot_pyz_rdataframe_misc rdataframe_misc.py)
endif()

# SOFIE-GNN pythonizations
Expand Down
34 changes: 34 additions & 0 deletions bindings/pyroot/pythonizations/test/rdataframe_misc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import cppyy
import platform
import unittest

import ROOT


class RDataFrameMisc(unittest.TestCase):
"""Miscellaneous RDataFrame tests"""

def test_empty_filenames(self):
"""
An empty list of filenames should be detected and the user should be informed
"""
# See https://github.com/root-project/root/issues/7541 and
# https://bugs.llvm.org/show_bug.cgi?id=49692 :
# llvm JIT fails to catch exceptions on MacOS ARM, so we disable their testing
# Also fails on Windows 64bit for the same reason
if (
(platform.processor() != "arm" or platform.mac_ver()[0] == '') and not
(platform.system() == "Windows" and platform.architecture()[0] == "64bit")
):
with self.assertRaisesRegexp(cppyy.gbl.runtime_error, "RDataFrame: empty list of input files."):
ROOT.RDataFrame("events", [])

with self.assertRaisesRegexp(cppyy.gbl.runtime_error, "RDataFrame: empty list of input files."):
ROOT.RDataFrame("events", ROOT.std.vector[ROOT.std.string]())

with self.assertRaisesRegexp(cppyy.gbl.runtime_error, "RDataFrame: empty list of input files."):
ROOT.RDataFrame("events", ())


if __name__ == '__main__':
unittest.main()

0 comments on commit b4bc365

Please sign in to comment.