def testGetInfo(self): """ _testGetInfo_ Test the getInfo() method of the File class to make sure that it returns the correct information. """ testFileParent = File(lfn = "/this/is/a/parent/lfn", size = 1024, events = 20, checksums={'cksum': 1111}) testFileParent.addRun(Run(1, *[45])) testFileParent.create() testFile = File(lfn = "/this/is/a/lfn", size = 1024, events = 10, checksums={'cksum': 222}) testFile.addRun(Run(1, *[45])) testFile.addRun(Run(2, *[46, 47])) testFile.addRun(Run(2, *[47, 48])) testFile.create() testFile.setLocation(se = "se1.fnal.gov", immediateSave = False) testFile.setLocation(se = "se1.cern.ch", immediateSave = False) testFile.addParent("/this/is/a/parent/lfn") info = testFile.getInfo() assert info[0] == testFile["lfn"], \ "ERROR: File returned wrong LFN" assert info[1] == testFile["id"], \ "ERROR: File returned wrong ID" assert info[2] == testFile["size"], \ "ERROR: File returned wrong size" assert info[3] == testFile["events"], \ "ERROR: File returned wrong events" assert info[4] == testFile["checksums"], \ "ERROR: File returned wrong cksum" assert len(info[5]) == 2, \ "ERROR: File returned wrong runs" assert info[5] == [Run(1, *[45]), Run(2, *[46, 47, 48])], \ "Error: Run hasn't been combined correctly" assert len(info[6]) == 2, \ "ERROR: File returned wrong locations" for testLocation in info[6]: assert testLocation in ["se1.fnal.gov", "se1.cern.ch"], \ "ERROR: File returned wrong locations" assert len(info[7]) == 1, \ "ERROR: File returned wrong parents" assert info[7][0] == testFileParent, \ "ERROR: File returned wrong parents" testFile.delete() testFileParent.delete() return
def testGetInfo(self): """ _testGetInfo_ Test the getInfo() method of the File class to make sure that it returns the correct information. """ testFileParent = File(lfn="/this/is/a/parent/lfn", size=1024, events=20, checksums={'cksum': 1111}) testFileParent.addRun(Run(1, *[45])) testFileParent.create() testFile = File(lfn="/this/is/a/lfn", size=1024, events=10, checksums={'cksum': 222}) testFile.addRun(Run(1, *[45])) testFile.addRun(Run(2, *[46, 47])) testFile.addRun(Run(2, *[47, 48])) testFile.create() testFile.setLocation(se="se1.fnal.gov", immediateSave=False) testFile.setLocation(se="se1.cern.ch", immediateSave=False) testFile.addParent("/this/is/a/parent/lfn") info = testFile.getInfo() assert info[0] == testFile["lfn"], \ "ERROR: File returned wrong LFN" assert info[1] == testFile["id"], \ "ERROR: File returned wrong ID" assert info[2] == testFile["size"], \ "ERROR: File returned wrong size" assert info[3] == testFile["events"], \ "ERROR: File returned wrong events" assert info[4] == testFile["checksums"], \ "ERROR: File returned wrong cksum" assert len(info[5]) == 2, \ "ERROR: File returned wrong runs" assert info[5] == [Run(1, *[45]), Run(2, *[46, 47, 48])], \ "Error: Run hasn't been combined correctly" assert len(info[6]) == 2, \ "ERROR: File returned wrong locations" for testLocation in info[6]: assert testLocation in ["se1.fnal.gov", "se1.cern.ch"], \ "ERROR: File returned wrong locations" assert len(info[7]) == 1, \ "ERROR: File returned wrong parents" assert info[7][0] == testFileParent, \ "ERROR: File returned wrong parents" testFile.delete() testFileParent.delete() return