def test_chases_roundtrip(self): with tb.File(self.h5_name, mode='a') as h5_file: io.chase_database(h5_file) chase_keys = sorted(io.read_chases(h5_file).keys()) self.assertEqual(chase_keys, self.ref_chase_keys) io.remove_chases(h5_file) with self.assertRaises(tb.NoSuchNodeError): io.read_chases(h5_file)
def test_chases_exceptions(self): with tb.File(self.h5_name, mode='a') as h5_file: # No chases io.remove_chases(h5_file) # Pass if no chases with self.assertRaises(tb.NoSuchNodeError): io.read_chases(h5_file) # Non-complient chase chases_group = h5_file.create_group('/', 'chases') h5_file.create_array(chases_group, 'fail_chase', obj='[fail)'.encode()) h5_file.flush() with self.assertRaises(ValueError): io.read_chases(h5_file) # Already chased database with self.assertRaises(tb.NodeError): io.chase_database(h5_file)