11import os
22import sys
33from pathlib import Path
4+
45from matplotlib .testing .compare import compare_images
5- from ..exceptions import GMTImageComparisonFailure
6+
7+ from ..exceptions import GMTImageComparisonFailure , GMTInvalidInput
68
79
810def check_figures_equal (fig_ref , fig_test , fig_prefix = None , tol = 0.0 ):
@@ -11,13 +13,13 @@ def check_figures_equal(fig_ref, fig_test, fig_prefix=None, tol=0.0):
1113 if not fig_prefix :
1214 try :
1315 fig_prefix = sys ._getframe (1 ).f_code .co_name
14- except VauleError :
16+ except ValueError :
1517 raise GMTInvalidInput ("fig_prefix is required." )
1618
1719 os .makedirs (result_dir , exist_ok = True )
1820
19- ref_image_path = os .path .join (result_dir , fig_prefix + ' -expected.png' )
20- test_image_path = os .path .join (result_dir , fig_prefix + ' .png' )
21+ ref_image_path = os .path .join (result_dir , fig_prefix + " -expected.png" )
22+ test_image_path = os .path .join (result_dir , fig_prefix + " .png" )
2123
2224 fig_ref .savefig (ref_image_path )
2325 fig_test .savefig (test_image_path )
@@ -31,5 +33,5 @@ def check_figures_equal(fig_ref, fig_test, fig_prefix=None, tol=0.0):
3133 for key in ["actual" , "expected" ]:
3234 err [key ] = os .path .relpath (err [key ])
3335 raise GMTImageComparisonFailure (
34- ' images not close (RMS %(rms).3f):\n \t %(actual)s\n \t %(expected)s '
35- % err )
36+ " images not close (RMS %(rms).3f):\n \t %(actual)s\n \t %(expected)s " % err
37+ )
0 commit comments