File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 3838 AncillaryVariableNotFoundError ,
3939 UnitConversionError ,
4040)
41- from iris .experimental .representation import CubeRepresentation
4241from iris ._lazy_data import as_lazy_data
4342import iris .tests .stock as stock
4443
@@ -2417,15 +2416,12 @@ class Test__repr_html(tests.IrisTest):
24172416 def test_bad_repr (self ):
24182417 # If an html repr fails we don't want it to pass the error.
24192418 cube = stock .simple_3d ()
2420- bad_attr = {'history' : 'First edit\n Second edit' }
2421- cube .attributes .update (bad_attr )
2422- representer = CubeRepresentation (cube )
2423-
2424- # Confirm we get an exception when we make the html repr...
2425- with self .assertRaisesRegexp (ValueError , 'substring' ):
2426- representer .repr_html ()
2427- # ... and that it's not returned by the cube method.
2428- self .assertIsNone (cube ._repr_html_ ())
2419+ with mock .patch (
2420+ "iris.experimental.representation.CubeRepresentation.repr_html" ,
2421+ side_effect = ValueError ('Bad substring' )):
2422+ # Confirm the exception when we make the html repr is not returned
2423+ # by the cube method.
2424+ self .assertIsNone (cube ._repr_html_ ())
24292425
24302426
24312427if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments