diff --git a/src/uproot/version.py b/src/uproot/version.py index 7dc2ff112..05897ca84 100644 --- a/src/uproot/version.py +++ b/src/uproot/version.py @@ -12,7 +12,7 @@ import re -__version__ = "5.2.0rc3" +__version__ = "5.2.0rc4" version = __version__ version_info = tuple(re.split(r"[-\.]", __version__)) diff --git a/tests/test_0692_fsspec_reading.py b/tests/test_0692_fsspec_reading.py index d2851c0d1..18dbaab1f 100644 --- a/tests/test_0692_fsspec_reading.py +++ b/tests/test_0692_fsspec_reading.py @@ -15,6 +15,8 @@ import os import sys +is_windows = sys.platform.startswith("win") + @pytest.mark.parametrize( "urlpath, source_class", @@ -166,6 +168,61 @@ def test_open_fsspec_xrootd(handler): assert (data == 194778).all() +@pytest.mark.parametrize( + "handler", + [ + uproot.source.file.MemmapSource, + uproot.source.file.MultithreadedFileSource, + uproot.source.fsspec.FSSpecSource, + None, + ], +) +@pytest.mark.skipif( + is_windows, reason="Windows does not support colons (':') in filenames" +) +def test_issue_1054_filename_colons(handler): + root_filename = "uproot-issue121.root" + local_path = str(skhep_testdata.data_path(root_filename)) + local_path_new = local_path[: -len(root_filename)] + "file:with:colons.root" + os.rename(local_path, local_path_new) + with uproot.open(local_path_new, handler=handler) as f: + data = f["Events/MET_pt"].array(library="np") + assert len(data) == 40 + + with uproot.open(local_path_new + ":Events", handler=handler) as tree: + data = tree["MET_pt"].array(library="np") + assert len(data) == 40 + + with uproot.open(local_path_new + ":Events/MET_pt", handler=handler) as branch: + data = branch.array(library="np") + assert len(data) == 40 + + +@pytest.mark.parametrize( + "handler", + [ + uproot.source.file.MemmapSource, + uproot.source.file.MultithreadedFileSource, + uproot.source.fsspec.FSSpecSource, + None, + ], +) +def test_issue_1054_object_path_split(handler): + root_filename = "uproot-issue121.root" + local_path = str(skhep_testdata.data_path(root_filename)) + with uproot.open(local_path, handler=handler) as f: + data = f["Events/MET_pt"].array(library="np") + assert len(data) == 40 + + with uproot.open(local_path + ":Events", handler=handler) as tree: + data = tree["MET_pt"].array(library="np") + assert len(data) == 40 + + with uproot.open(local_path + ":Events/MET_pt", handler=handler) as branch: + data = branch.array(library="np") + assert len(data) == 40 + + def test_fsspec_chunks(server): pytest.importorskip("aiohttp")