def test_error(self): # Test what happens when we call: # ProtoCube.register(cube, error_on_mismatch=True) proto_cube = ProtoCube(self.cube1) if self.fragments: with self.assertRaises(iris.exceptions.MergeError) as cm: proto_cube.register(self.cube2, error_on_mismatch=True) error_message = str(cm.exception) for substr in self.fragments: self.assertIn(substr, error_message) else: result = proto_cube.register(self.cube2, error_on_mismatch=True) self.assertTrue(result)
def test_no_error(self): # Test what happens when we call: # ProtoCube.register(cube, error_on_mismatch=False) proto_cube = ProtoCube(self.cube1) result = proto_cube.register(self.cube2, error_on_mismatch=False) self.assertEqual(result, not self.fragments)
def test_default(self): # Test what happens when we call: # ProtoCube.register(cube) proto_cube = ProtoCube(self.cube1) result = proto_cube.register(self.cube2) self.assertEqual(result, not self.fragments)