Skip to content

Commit 27e03ed

Browse files
committed
Black lint, fix typos and run isort
1 parent 847814b commit 27e03ed

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

pygmt/exceptions.py

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class GMTVersionError(GMTError):
4545
Raised when an incompatible version of GMT is being used.
4646
"""
4747

48+
4849
class GMTImageComparisonFailure(AssertionError):
4950
"""
5051
Raised when a comparison between two images fails.

pygmt/helpers/testing.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22
import sys
33
from pathlib import Path
4+
45
from matplotlib.testing.compare import compare_images
5-
from ..exceptions import GMTImageComparisonFailure
6+
7+
from ..exceptions import GMTImageComparisonFailure, GMTInvalidInput
68

79

810
def 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+
)

pygmt/tests/test.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import pygmt
21
from matplotlib.testing.decorators import check_figures_equal
32

4-
@check_figures_equal(extensions=['png'])
3+
import pygmt
4+
5+
6+
@check_figures_equal(extensions=["png"])
57
def test_plot(fig_test, fig_ref):
68
fig_test.subplots().plot([1, 3, 5])
79
fig_ref.subplots().plot([0, 1, 2], [1, 3, 5])

pygmt/tests/test_grdimage.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def test_grdimage_over_dateline(xrgrid):
9898

9999
def test_grdimage_central_longitude(grid):
100100
fig1 = Figure()
101-
fig1.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap='geo')
101+
fig1.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo")
102102

103103
fig2 = Figure()
104-
fig2.grdimage(grid, projection="W120/15c", cmap='geo')
104+
fig2.grdimage(grid, projection="W120/15c", cmap="geo")
105105

106106
check_figures_equal(fig1, fig2)

pygmt/tests/test_testing.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
22
Test the testing functions for PyGMT
33
"""
4+
import pytest
5+
46
from .. import Figure
5-
from ..helpers.testing import check_figures_equal
67
from ..exceptions import GMTImageComparisonFailure
7-
import pytest
8+
from ..helpers.testing import check_figures_equal
89

910

1011
def test_check_figures_equal():

0 commit comments

Comments
 (0)