Skip to content

Commit 10ef9e1

Browse files
authored
Merge pull request #9304 from QuLogic/fedora-build-patches
Fedora build patches
2 parents 4ad5179 + ec77e80 commit 10ef9e1

File tree

9 files changed

+46
-21
lines changed

9 files changed

+46
-21
lines changed

lib/matplotlib/image.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,10 @@ def get_cursor_data(self, event):
829829
array_extent = Bbox([[0, 0], arr.shape[:2]])
830830
trans = BboxTransform(boxin=data_extent, boxout=array_extent)
831831
y, x = event.ydata, event.xdata
832-
i, j = trans.transform_point([y, x]).astype(int)
832+
point = trans.transform_point([y, x])
833+
if any(np.isnan(point)):
834+
return None
835+
i, j = point.astype(int)
833836
# Clip the coordinates at array bounds
834837
if not (0 <= i < arr.shape[0]) or not (0 <= j < arr.shape[1]):
835838
return None

lib/matplotlib/sphinxext/tests/test_tinypages.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ def setup_module():
2222
ret = call([sys.executable, '-msphinx', '--help'],
2323
stdout=PIPE, stderr=PIPE)
2424
if ret != 0:
25-
raise RuntimeError(
26-
"'{} -msphinx' does not return 0".format(sys.executable))
25+
pytest.skip("'{} -msphinx' does not return 0".format(sys.executable))
2726

2827

2928
@cbook.deprecated("2.1", alternative="filecmp.cmp")

lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,13 +1677,19 @@ def _as_mpl_axes(self):
16771677
ax_via_gca = plt.gca(projection=prj)
16781678
assert ax_via_gca is ax
16791679
# try getting the axes given a different polar projection
1680-
ax_via_gca = plt.gca(projection=prj2)
1680+
with pytest.warns(UserWarning) as rec:
1681+
ax_via_gca = plt.gca(projection=prj2)
1682+
assert len(rec) == 1
1683+
assert 'Requested projection is different' in str(rec[0].message)
16811684
assert ax_via_gca is not ax
16821685
assert ax.get_theta_offset() == 0, ax.get_theta_offset()
16831686
assert ax_via_gca.get_theta_offset() == np.pi, \
16841687
ax_via_gca.get_theta_offset()
16851688
# try getting the axes given an == (not is) polar projection
1686-
ax_via_gca = plt.gca(projection=prj3)
1689+
with pytest.warns(UserWarning):
1690+
ax_via_gca = plt.gca(projection=prj3)
1691+
assert len(rec) == 1
1692+
assert 'Requested projection is different' in str(rec[0].message)
16871693
assert ax_via_gca is ax
16881694
plt.close()
16891695

lib/matplotlib/tests/test_cbook.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ def test_is_hashable():
2929

3030
def test_restrict_dict():
3131
d = {'foo': 'bar', 1: 2}
32-
d1 = cbook.restrict_dict(d, ['foo', 1])
33-
assert d1 == d
34-
d2 = cbook.restrict_dict(d, ['bar', 2])
35-
assert d2 == {}
36-
d3 = cbook.restrict_dict(d, {'foo': 1})
37-
assert d3 == {'foo': 'bar'}
38-
d4 = cbook.restrict_dict(d, {})
39-
assert d4 == {}
40-
d5 = cbook.restrict_dict(d, {'foo', 2})
41-
assert d5 == {'foo': 'bar'}
32+
with pytest.warns(cbook.deprecation.MatplotlibDeprecationWarning) as rec:
33+
d1 = cbook.restrict_dict(d, ['foo', 1])
34+
assert d1 == d
35+
d2 = cbook.restrict_dict(d, ['bar', 2])
36+
assert d2 == {}
37+
d3 = cbook.restrict_dict(d, {'foo': 1})
38+
assert d3 == {'foo': 'bar'}
39+
d4 = cbook.restrict_dict(d, {})
40+
assert d4 == {}
41+
d5 = cbook.restrict_dict(d, {'foo', 2})
42+
assert d5 == {'foo': 'bar'}
43+
assert len(rec) == 5
4244
# check that d was not modified
4345
assert d == {'foo': 'bar', 1: 2}
4446

lib/matplotlib/tests/test_colors.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ def test_tableau_order():
690690
assert list(mcolors.TABLEAU_COLORS.values()) == dflt_cycle
691691

692692

693-
def test_ndarray_subclass_norm():
693+
def test_ndarray_subclass_norm(recwarn):
694694
# Emulate an ndarray subclass that handles units
695695
# which objects when adding or subtracting with other
696696
# arrays. See #6622 and #8696
@@ -707,3 +707,11 @@ def __add__(self, other):
707707
mcolors.SymLogNorm(3, vmax=5, linscale=1),
708708
mcolors.PowerNorm(1)]:
709709
assert_array_equal(norm(data.view(MyArray)), norm(data))
710+
if isinstance(norm, mcolors.PowerNorm):
711+
assert len(recwarn) == 1
712+
warn = recwarn.pop(UserWarning)
713+
assert ('Power-law scaling on negative values is ill-defined'
714+
in str(warn.message))
715+
else:
716+
assert len(recwarn) == 0
717+
recwarn.clear()

lib/matplotlib/tests/test_compare_images.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def addFailure(self, test, err):
203203
assert failures[self.failure_count][1] in str(err[1])
204204
self.failure_count += 1
205205

206+
# Make sure that multiple extensions work, but don't require LaTeX or
207+
# Inkscape to do so.
208+
kwargs.setdefault('extensions', ['png', 'png', 'png'])
209+
206210
func = image_comparison(**kwargs)(func)
207211
loader = nose.loader.TestLoader()
208212
suite = loader.loadTestsFromGenerator(

lib/matplotlib/tests/test_dates.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ def test_too_many_date_ticks():
9696
tf = datetime.datetime(2000, 1, 20)
9797
fig = plt.figure()
9898
ax = fig.add_subplot(1, 1, 1)
99-
ax.set_xlim((t0, tf), auto=True)
99+
with pytest.warns(UserWarning) as rec:
100+
ax.set_xlim((t0, tf), auto=True)
101+
assert len(rec) == 1
102+
assert 'Attempting to set identical left==right' in str(rec[0].message)
100103
ax.plot([], [])
101104
ax.xaxis.set_major_locator(mdates.DayLocator())
102105
with pytest.raises(RuntimeError):

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ def test_load_from_url():
603603

604604
@image_comparison(baseline_images=['log_scale_image'],
605605
remove_text=True)
606-
def test_log_scale_image():
606+
# The recwarn fixture captures a warning in image_comparison.
607+
def test_log_scale_image(recwarn):
607608
Z = np.zeros((10, 10))
608609
Z[::2] = 1
609610

@@ -615,7 +616,6 @@ def test_log_scale_image():
615616
ax.set_yscale('log')
616617

617618

618-
619619
@image_comparison(baseline_images=['rotate_image'],
620620
remove_text=True)
621621
def test_rotate_image():

lib/matplotlib/tests/test_mlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import warnings
88

99
from numpy.testing import (assert_allclose, assert_almost_equal,
10-
assert_array_equal)
10+
assert_array_equal, assert_array_almost_equal_nulp)
1111
import numpy.ma.testutils as matest
1212
import numpy as np
1313
import datetime as datetime
@@ -1985,7 +1985,7 @@ def test_psd_csd_equal(self):
19851985
noverlap=self.nover_density,
19861986
pad_to=self.pad_to_density,
19871987
sides=self.sides)
1988-
assert_array_equal(Pxx, Pxy)
1988+
assert_array_almost_equal_nulp(Pxx, Pxy)
19891989
assert_array_equal(freqsxx, freqsxy)
19901990

19911991
def test_specgram_auto_default_equal(self):

0 commit comments

Comments
 (0)