From 498ac1dca5c1c30bc9fa3bc2ec722c33ebbd93a8 Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Sun, 27 Feb 2022 11:57:52 +0100 Subject: [PATCH] [PyROOT][NFC] Test TKey's title of TObject-derived class --- .../test/tfile_attrsyntax_get_writeobject_open.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bindings/pyroot/pythonizations/test/tfile_attrsyntax_get_writeobject_open.py b/bindings/pyroot/pythonizations/test/tfile_attrsyntax_get_writeobject_open.py index ea554b79bf8ef..24e7f74734a19 100644 --- a/bindings/pyroot/pythonizations/test/tfile_attrsyntax_get_writeobject_open.py +++ b/bindings/pyroot/pythonizations/test/tfile_attrsyntax_get_writeobject_open.py @@ -75,6 +75,20 @@ def test_oserror(self): handle = ROOT.TFile.AsyncOpen("inexistent_file.root") self.assertRaises(OSError, ROOT.TFile.Open, handle) + def test_keys_title(self): + """ + Test that the TKey related to a histogram in the file contains the + histogram title as described in #9989. + """ + finput = ROOT.TFile.Open(self.filename) + key1 = finput.GetListOfKeys().At(0) + key2 = finput.Get("dir1").GetListOfKeys().At(0) + key3 = finput.Get("dir1/dir2").GetListOfKeys().At(0) + self.assertEqual(key1.GetTitle(), "h") + self.assertEqual(key2.GetTitle(), "h1") + self.assertEqual(key3.GetTitle(), "h2") + finput.Close() + if __name__ == '__main__': unittest.main()