def test_save(self): """ Test saving a datacube to a binary file """ for key in self.testCubes.keys(): print "Checking binary loading of test cube {0!s}".format(key) cube = self.testCubes[key] filename = os.path.normpath(self.dataPath+"/test_{0!s}.dat".format(key)) cube.save(filename) self.assert_(os.path.exists(filename),"File {0!s} has not been created!".format(filename)) self.assert_(os.path.isfile(filename)) restoredCube = Datacube() restoredCube.load(filename) self.assert_(restoredCube.equal(cube),"Error: Restored datacube does not match original one!")