示例#1
0
    def test01PythonizationOfGet(self):
        """TFile::Get pythonization checks classes"""

        totalEvents = TArrayI(1)
        f = TFile(self.fname, 'RECREATE')
        f.WriteObject(totalEvents, 'totalEvents')
        f.Close()

        f = TFile(self.fname)
        self.assertEqual(f.GetKey('totalEvents').GetClassName(), 'TArrayI')
        self.assert_(f.Get('totalEvents'))
        self.assertEqual(f.Get('totalEvents').GetSize(), 1)
        self.assertEqual(f.totalEvents.GetSize(), 1)

        # the following used to crash
        self.assert_(not gDirectory.Get("non_existent_stuff"))