From 8286d7e6297b02981df822cbbb84de8d51ce0708 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Thu, 3 Sep 2020 13:55:04 +1200 Subject: [PATCH] Black lint code --- pygmt/exceptions.py | 1 + pygmt/helpers/testing.py | 8 ++++---- pygmt/tests/test.py | 3 ++- pygmt/tests/test_grdimage.py | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pygmt/exceptions.py b/pygmt/exceptions.py index fbd429e29f4..6b72b8cb919 100644 --- a/pygmt/exceptions.py +++ b/pygmt/exceptions.py @@ -45,6 +45,7 @@ class GMTVersionError(GMTError): Raised when an incompatible version of GMT is being used. """ + class GMTImageComparisonFailure(AssertionError): """ Raised when a comparison between two images fails. diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 2dc14eb44ea..44693be2d71 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -16,8 +16,8 @@ def check_figures_equal(fig_ref, fig_test, fig_prefix=None, tol=0.0): os.makedirs(result_dir, exist_ok=True) - ref_image_path = os.path.join(result_dir, fig_prefix + '-expected.png') - test_image_path = os.path.join(result_dir, fig_prefix + '.png') + ref_image_path = os.path.join(result_dir, fig_prefix + "-expected.png") + test_image_path = os.path.join(result_dir, fig_prefix + ".png") fig_ref.savefig(ref_image_path) fig_test.savefig(test_image_path) @@ -31,5 +31,5 @@ def check_figures_equal(fig_ref, fig_test, fig_prefix=None, tol=0.0): for key in ["actual", "expected"]: err[key] = os.path.relpath(err[key]) raise GMTImageComparisonFailure( - 'images not close (RMS %(rms).3f):\n\t%(actual)s\n\t%(expected)s ' - % err) + "images not close (RMS %(rms).3f):\n\t%(actual)s\n\t%(expected)s " % err + ) diff --git a/pygmt/tests/test.py b/pygmt/tests/test.py index 43d6c94edb8..f86d02088e8 100644 --- a/pygmt/tests/test.py +++ b/pygmt/tests/test.py @@ -1,7 +1,8 @@ import pygmt from matplotlib.testing.decorators import check_figures_equal -@check_figures_equal(extensions=['png']) + +@check_figures_equal(extensions=["png"]) def test_plot(fig_test, fig_ref): fig_test.subplots().plot([1, 3, 5]) fig_ref.subplots().plot([0, 1, 2], [1, 3, 5]) diff --git a/pygmt/tests/test_grdimage.py b/pygmt/tests/test_grdimage.py index 9a283c97ee0..bd4282b4f02 100644 --- a/pygmt/tests/test_grdimage.py +++ b/pygmt/tests/test_grdimage.py @@ -98,9 +98,9 @@ def test_grdimage_over_dateline(xrgrid): def test_grdimage_central_longitude(grid): fig1 = Figure() - fig1.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap='geo') + fig1.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo") fig2 = Figure() - fig2.grdimage(grid, projection="W120/15c", cmap='geo') + fig2.grdimage(grid, projection="W120/15c", cmap="geo") check_figures_equal(fig1, fig2)