예제 #1
0
    def test07WriteNonTObject(self):
        """Test writing of a non-TObject derived instance"""

        f = TFile(self.fname, 'RECREATE')

        myarray = TArrayI(1)
        f.WriteObject(myarray, 'myarray')

        f.Close()
예제 #2
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"))