MCPcopy Create free account
hub / github.com/PyTables/PyTables / test00b_firstclass

Method test00b_firstclass

tables/tests/test_create.py:1242–1280  ·  view source on GitHub ↗

Checking copy of a File (first-class function)

(self)

Source from the content-addressed store, hash-verified

1240 self.assertRaises(IOError, self.h5file.copy_file, self.h5file.filename)
1241
1242 def test00b_firstclass(self):
1243 """Checking copy of a File (first-class function)"""
1244
1245 if common.verbose:
1246 print("\n", "-=" * 30)
1247 print("Running %s.test00b_firstclass..." % self.__class__.__name__)
1248
1249 # Close the temporary file
1250 self.h5file.close()
1251
1252 # Copy the file to the destination
1253 tb.copy_file(
1254 self.h5fname,
1255 self.h5fname2,
1256 title=self.title,
1257 copyuserattrs=0,
1258 filters=None,
1259 overwrite=1,
1260 )
1261
1262 # ...and open the source and destination file
1263 self.h5file = tb.open_file(self.h5fname, "r")
1264 self.h5file2 = tb.open_file(self.h5fname2, "r")
1265
1266 # Check that the copy has been done correctly
1267 srcgroup = self.h5file.root
1268 dstgroup = self.h5file2.root
1269 nodelist1 = list(srcgroup._v_children)
1270 nodelist2 = list(dstgroup._v_children)
1271
1272 # Sort the lists
1273 nodelist1.sort()
1274 nodelist2.sort()
1275 if common.verbose:
1276 print("The origin node list -->", nodelist1)
1277 print("The copied node list -->", nodelist2)
1278 self.assertEqual(srcgroup._v_nchildren, dstgroup._v_nchildren)
1279 self.assertEqual(nodelist1, nodelist2)
1280 self.assertEqual(self.h5file2.title, self.title)
1281
1282 def test01_copy(self):
1283 """Checking copy of a File (attributes not copied)"""

Callers

nothing calls this directly

Calls 2

copy_fileMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected