diff --git a/src/uproot/reading.py b/src/uproot/reading.py index 362a87307..aa4ac2653 100644 --- a/src/uproot/reading.py +++ b/src/uproot/reading.py @@ -2473,9 +2473,13 @@ def get(self): else: chunk, cursor = self.get_uncompressed_chunk_cursor() start_cursor = cursor.copy() - cls = self._file.class_named(self._fClassName) context = {"breadcrumbs": (), "TKey": self} + if self._fClassName == "string": + return cursor.string(chunk, context) + + cls = self._file.class_named(self._fClassName) + try: out = cls.read(chunk, cursor, context, self._file, selffile, parent) diff --git a/tests/test_0692_fsspec_reading.py b/tests/test_0692_fsspec_reading.py index ff31b7ca0..097f34cef 100644 --- a/tests/test_0692_fsspec_reading.py +++ b/tests/test_0692_fsspec_reading.py @@ -395,6 +395,7 @@ def test_issue_1035(handler): assert len(data) == 40 +@pytest.mark.skip(reason="This test occasionally takes too long: GitHub kills it.") @pytest.mark.network @pytest.mark.xrootd @pytest.mark.parametrize( diff --git a/tests/test_1160_std_string_in_TDirectory.py b/tests/test_1160_std_string_in_TDirectory.py new file mode 100644 index 000000000..ce81976ed --- /dev/null +++ b/tests/test_1160_std_string_in_TDirectory.py @@ -0,0 +1,19 @@ +# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE + +import json + +import skhep_testdata + +import uproot + + +def test(): + with uproot.open(skhep_testdata.data_path("string-example.root")) as file: + assert json.loads(file["FileSummaryRecord"]) == { + "LumiCounter.eventsByRun": { + "counts": {}, + "empty": True, + "type": "LumiEventCounter", + }, + "guid": "5FE9437E-D958-11EE-AB88-3CECEF1070AC", + }