Skip to content
Snippets Groups Projects
Commit 3f2e5a2b authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Add UUID accessors

parent c5b64d9a
No related branches found
No related tags found
No related merge requests found
Pipeline #14338 passed with warnings
Unreleased changes
------------------
* Adds ``.uuid`` attributes to ``OfflineReader`` and ``OnlineReader``
Version 0
---------
......
......@@ -160,7 +160,7 @@ class OfflineReader:
self._fobj = uproot.open(file_path)
self._filename = file_path
self._tree = self._fobj[MAIN_TREE_NAME]
self._uuid = binascii.hexlify(self._fobj._context.uuid)
self._uuid = binascii.hexlify(self._fobj._context.uuid).decode("ascii")
@property
def uuid(self):
......
......@@ -116,7 +116,7 @@ class OnlineReader:
self._events = None
self._timeslices = None
self._summaryslices = None
self._uuid = binascii.hexlify(self._fobj._context.uuid)
self._uuid = binascii.hexlify(self._fobj._context.uuid).decode("ascii")
@property
def uuid(self):
......
......@@ -31,6 +31,9 @@ class TestOfflineReader(unittest.TestCase):
def test_number_events(self):
assert self.n_events == len(self.r.events)
def test_uuid(self):
assert self.r.uuid == "0001b192d888fcc711e9b4306cf09e86beef"
class TestHeader(unittest.TestCase):
def test_str_header(self):
......
......@@ -18,6 +18,11 @@ class TestOnlineReaderContextManager(unittest.TestCase):
assert r._filename == ONLINE_FILE
class TestUUID(unittest.TestCase):
def test_uuid(self):
assert OnlineReader(ONLINE_FILE).uuid == "00010c85603008c611ea971772f09e86beef"
class TestOnlineEvents(unittest.TestCase):
def setUp(self):
self.events = OnlineReader(ONLINE_FILE).events
......
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