Skip to content

Commit 32a3bb9

Browse files
authored
Merge pull request #431 from nschloe/fix-tests
Fix tests
2 parents ddf7ae3 + 83e474b commit 32a3bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+66
-89
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/setup-python@v1
9+
- uses: actions/setup-python@v2
1010
with:
1111
python-version: "3.x"
1212
- uses: actions/checkout@v2
@@ -25,7 +25,7 @@ jobs:
2525
matrix:
2626
python-version: [3.6, 3.7, 3.8]
2727
steps:
28-
- uses: actions/setup-python@v1
28+
- uses: actions/setup-python@v2
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131
- uses: actions/checkout@v2

Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ default:
66
tag:
77
# Make sure we're on the master branch
88
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
9-
# @echo "Tagging v$(VERSION)..."
10-
# git tag v$(VERSION)
11-
# git push --tags
129
curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "v$(VERSION)"}' https://api.github.com/repos/nschloe/tikzplotlib/releases
1310

1411
upload:
1512
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
1613
rm -f dist/*
17-
# python3 setup.py sdist bdist_wheel
1814
# https://stackoverflow.com/a/58756491/353337
1915
python3 -m pep517.build --source --binary .
2016
twine upload dist/*
@@ -26,10 +22,7 @@ clean:
2622
@rm -rf *.egg-info/ build/ dist/ MANIFEST
2723

2824
format:
29-
isort -rc .
30-
black .
31-
32-
black:
25+
isort .
3326
black .
3427

3528
lint:

test/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def assert_equality(
4545
this_dir = os.path.dirname(os.path.abspath(__file__))
4646
with open(os.path.join(this_dir, filename), encoding="utf-8") as f:
4747
reference = f.read()
48-
assert reference == code, _unidiff_output(code, reference)
48+
assert reference == code, _unidiff_output(reference, code)
4949

5050
if assert_compilation:
5151
plot()

test/test_annotate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

@@ -38,7 +37,6 @@ def plot():
3837

3938
def test():
4039
assert_equality(plot, __file__[:-3] + "_reference.tex")
41-
return
4240

4341

4442
if __name__ == "__main__":

test/test_axvline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_barchart.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66
import matplotlib.pyplot as plt
77
import numpy as np
8-
98
from helpers import assert_equality
109

1110

test/test_barchart_errorbars.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66
import matplotlib.pyplot as plt
77
import numpy as np
8-
98
from helpers import assert_equality
109

1110

test/test_barchart_legend.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010
import matplotlib.pyplot as plt
1111
import numpy as np
12-
1312
from helpers import assert_equality
1413

1514

@@ -34,7 +33,6 @@ def plot():
3433

3534
def test():
3635
assert_equality(plot, "test_barchart_legend_reference.tex")
37-
return
3836

3937

4038
if __name__ == "__main__":

test/test_basic_sin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_boxplot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
See: https://github.com/nschloe/tikzplotlib/pull/134
77
"""
88
import matplotlib.pyplot as plt
9-
109
from helpers import assert_equality
1110

1211

test/test_cleanfigure.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_wireframe3D(self):
203203

204204
def test_surface3D(self):
205205
from matplotlib import cm
206-
from matplotlib.ticker import LinearLocator, FormatStrFormatter
206+
from matplotlib.ticker import FormatStrFormatter, LinearLocator
207207

208208
# Make data.
209209
X = np.arange(-5, 5, 0.25)
@@ -265,8 +265,8 @@ def test_trisurface3D(self):
265265
plt.close("all")
266266

267267
def test_contour3D(self):
268-
from mpl_toolkits.mplot3d import axes3d
269268
from matplotlib import cm
269+
from mpl_toolkits.mplot3d import axes3d
270270

271271
with plt.rc_context(rc=RC_PARAMS):
272272
fig = plt.figure()
@@ -279,8 +279,8 @@ def test_contour3D(self):
279279
plt.close("all")
280280

281281
def test_polygon3D(self):
282-
from matplotlib.collections import PolyCollection
283282
from matplotlib import colors as mcolors
283+
from matplotlib.collections import PolyCollection
284284

285285
with plt.rc_context(rc=RC_PARAMS):
286286
fig = plt.figure()

test/test_colorbars.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib as mpl
22
import matplotlib.pyplot as plt
3-
43
from helpers import assert_equality
54

65

test/test_context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33

44
def plot():
5-
import numpy as np
6-
import matplotlib.pyplot as plt
75
import matplotlib.cm as cm
6+
import matplotlib.pyplot as plt
7+
import numpy as np
88

99
x, y = np.meshgrid(np.linspace(0, 1), np.linspace(0, 1))
1010
z = x ** 2 - y ** 2
1111

1212
fig = plt.figure()
13-
plt.pcolormesh(x, y, z, cmap=cm.viridis)
13+
plt.pcolormesh(x, y, z, cmap=cm.viridis, shading="gouraud")
1414

1515
return fig
1616

test/test_contourf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_custom_collection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import matplotlib
77
import matplotlib.pyplot as plt
88
import numpy as np
9-
109
from helpers import assert_equality
1110

1211

test/test_datetime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import datetime as date
22

33
import matplotlib.pyplot as plt
4-
from matplotlib import dates
5-
64
from helpers import assert_equality
5+
from matplotlib import dates
76

87

98
def plot():

test/test_datetime_paths.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import datetime as date
22

33
import matplotlib.pyplot as plt
4-
from matplotlib import dates
5-
64
from helpers import assert_equality
5+
from matplotlib import dates
76

87

98
def plot():

test/test_dual_axis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_errorband.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_errorbar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import matplotlib.pyplot as plt
2-
32
from helpers import assert_equality
43

54

test/test_escape_chars.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# https://github.com/nschloe/tikzplotlib/issues/332
22
import matplotlib.pyplot as plt
3-
43
from helpers import assert_equality
54

65

test/test_externalize_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
from matplotlib import pyplot as plt
65
import numpy as np
6+
from matplotlib import pyplot as plt
77

88
fig = plt.figure()
99
with plt.style.context("ggplot"):

test/test_fancy_colorbar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_fancybox.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Taken from http://matplotlib.org/examples/pylab_examples/fancybox_demo.html
22
import matplotlib.pyplot as plt
33
import matplotlib.transforms as mtransforms
4-
from matplotlib.patches import FancyBboxPatch
5-
64
from helpers import assert_equality
5+
from matplotlib.patches import FancyBboxPatch
76

87
# Bbox object around which the fancy box will be drawn.
98
bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]])

test/test_fillstyle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_heat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import matplotlib
22
import matplotlib.pyplot as plt
33
import numpy as np
4-
54
from helpers import assert_equality
65

76

test/test_histogram.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_image_plot_lower.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import matplotlib.pyplot as plt
2-
32
from helpers import assert_equality
43

54
# the picture 'lena.png' with origin='lower' is flipped upside-down.
65
# So it has to be upside-down in the pdf-file as well.
76

87

98
def plot():
10-
from matplotlib import rcParams
11-
import matplotlib.image as mpimg
129
import os
1310

11+
import matplotlib.image as mpimg
12+
from matplotlib import rcParams
13+
1414
this_dir = os.path.dirname(os.path.realpath(__file__))
1515
img = mpimg.imread(os.path.join(this_dir, "lena.png"))
1616

test/test_image_plot_upper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66

77
def plot():
8-
from matplotlib import rcParams
9-
import matplotlib.image as mpimg
108
import os
119

10+
import matplotlib.image as mpimg
11+
from matplotlib import rcParams
12+
1213
this_dir = os.path.dirname(os.path.realpath(__file__))
1314
img = mpimg.imread(os.path.join(this_dir, "lena.png"))
1415

test/test_legend_best_location.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_legend_columns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
import numpy as np
65
import matplotlib.pyplot as plt
6+
import numpy as np
77

88
fig, ax = plt.subplots(figsize=(17, 6))
99
ax.plot(np.array([1, 5]), label="Test 1")

test/test_legend_labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
from matplotlib import pyplot as plt
65
import numpy as np
6+
from matplotlib import pyplot as plt
77

88
fig = plt.figure()
99

test/test_legend_line_scatter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
43
from helpers import assert_equality
54

65

test/test_legends.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
from matplotlib import pyplot as plt
65
import numpy as np
6+
from matplotlib import pyplot as plt
77

88
fig = plt.figure()
99

test/test_legends2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
from matplotlib import pyplot as plt
65
import numpy as np
6+
from matplotlib import pyplot as plt
77

88
fig, ax = plt.subplots(3, 3, sharex="col", sharey="row")
99
axes = [ax[i][j] for i in range(len(ax)) for j in range(len(ax[i]))]

test/test_line_color_marker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def plot():
5-
from matplotlib import pyplot as plt
65
import numpy as np
6+
from matplotlib import pyplot as plt
77

88
fig = plt.figure()
99
with plt.style.context("ggplot"):

test/test_line_dashes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import matplotlib.pyplot as plt
2-
32
from helpers import assert_equality
43

54

0 commit comments

Comments
 (0)