mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-25 08:58:27 -07:00
dev-python/matplotlib: Backported test fix
Package-Manager: portage-2.2.23 Signed-off-by: Justin Lecher <jlec@gentoo.org>
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
commit f98c4846dc3c15b3d24aafb973764cb9b860d935
|
||||
Author: Thomas A Caswell <tcaswell@gmail.com>
|
||||
Date: Sat Jan 10 16:10:29 2015 -0500
|
||||
|
||||
MNT : removed deprecated method/kwargs from patheffects
|
||||
|
||||
Deprecated in #2462 / 84e0063bd37c629f129d36c548e8ce3a30692cae
|
||||
|
||||
attn @pelson had to known-fail a test which was using the
|
||||
proxy renderer to verify that PathEffectRender was working
|
||||
correctly.
|
||||
|
||||
diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py
|
||||
index 13f8ce0..19e1c4a 100644
|
||||
--- a/lib/matplotlib/patheffects.py
|
||||
+++ b/lib/matplotlib/patheffects.py
|
||||
@@ -10,9 +10,7 @@ from __future__ import (absolute_import, division, print_function,
|
||||
import six
|
||||
|
||||
from matplotlib.backend_bases import RendererBase
|
||||
-from matplotlib.backends.backend_mixed import MixedModeRenderer
|
||||
import matplotlib.transforms as mtransforms
|
||||
-import matplotlib.cbook as cbook
|
||||
from matplotlib.colors import colorConverter
|
||||
import matplotlib.patches as mpatches
|
||||
|
||||
@@ -42,12 +40,6 @@ class AbstractPathEffect(object):
|
||||
return transform + self._offset_trans.clear().translate(offset_x,
|
||||
offset_y)
|
||||
|
||||
- def get_proxy_renderer(self, renderer):
|
||||
- """Return a PathEffectRenderer instance for this PathEffect."""
|
||||
- cbook.deprecated('v1.4', name='get_proxy_renderer',
|
||||
- alternative='PathEffectRenderer')
|
||||
- return PathEffectRenderer([self], renderer)
|
||||
-
|
||||
def _update_gc(self, gc, new_gc_dict):
|
||||
"""
|
||||
Update the given GraphicsCollection with the given
|
||||
@@ -219,9 +211,9 @@ class withStroke(Stroke):
|
||||
|
||||
class SimplePatchShadow(AbstractPathEffect):
|
||||
"""A simple shadow via a filled patch."""
|
||||
- def __init__(self, offset=(2,-2),
|
||||
- shadow_rgbFace=None, alpha=None, patch_alpha=None,
|
||||
- rho=0.3, offset_xy=None, **kwargs):
|
||||
+ def __init__(self, offset=(2, -2),
|
||||
+ shadow_rgbFace=None, alpha=None,
|
||||
+ rho=0.3, **kwargs):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
@@ -241,24 +233,12 @@ class SimplePatchShadow(AbstractPathEffect):
|
||||
:meth:`AbstractPathEffect._update_gc`.
|
||||
|
||||
"""
|
||||
- if offset_xy is not None:
|
||||
- cbook.deprecated('v1.4', 'The offset_xy keyword is deprecated. '
|
||||
- 'Use the offset keyword instead.')
|
||||
- offset = offset_xy
|
||||
super(SimplePatchShadow, self).__init__(offset)
|
||||
|
||||
if shadow_rgbFace is None:
|
||||
self._shadow_rgbFace = shadow_rgbFace
|
||||
else:
|
||||
self._shadow_rgbFace = colorConverter.to_rgba(shadow_rgbFace)
|
||||
- if patch_alpha is not None:
|
||||
- cbook.deprecated('v1.4', 'The patch_alpha keyword is deprecated. '
|
||||
- 'Use the alpha keyword instead. Transform your '
|
||||
- 'patch_alpha by alpha = 1 - patch_alpha')
|
||||
- if alpha is not None:
|
||||
- raise ValueError("Both alpha and patch_alpha were set. "
|
||||
- "Just use alpha.")
|
||||
- alpha = 1 - patch_alpha
|
||||
|
||||
if alpha is None:
|
||||
alpha = 0.3
|
||||
diff --git a/lib/matplotlib/tests/test_patheffects.py b/lib/matplotlib/tests/test_patheffects.py
|
||||
index 8298ceb..5af71e5 100644
|
||||
--- a/lib/matplotlib/tests/test_patheffects.py
|
||||
+++ b/lib/matplotlib/tests/test_patheffects.py
|
||||
@@ -5,7 +5,8 @@ import six
|
||||
|
||||
import numpy as np
|
||||
|
||||
-from matplotlib.testing.decorators import image_comparison, cleanup
|
||||
+from matplotlib.testing.decorators import (image_comparison, cleanup,
|
||||
+ knownfailureif)
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.patheffects as path_effects
|
||||
|
||||
@@ -84,19 +85,7 @@ def test_patheffect3():
|
||||
|
||||
|
||||
@cleanup
|
||||
-def test_PathEffect_get_proxy():
|
||||
- pe = path_effects.AbstractPathEffect()
|
||||
- fig = plt.gcf()
|
||||
- renderer = fig.canvas.get_renderer()
|
||||
-
|
||||
- with mock.patch('matplotlib.cbook.deprecated') as dep:
|
||||
- proxy_renderer = pe.get_proxy_renderer(renderer)
|
||||
- assert_equal(proxy_renderer._renderer, renderer)
|
||||
- assert_equal(proxy_renderer._path_effects, [pe])
|
||||
- dep.assert_called()
|
||||
-
|
||||
-
|
||||
-@cleanup
|
||||
+@knownfailureif(True)
|
||||
def test_PathEffect_points_to_pixels():
|
||||
fig = plt.figure(dpi=150)
|
||||
p1, = plt.plot(range(10))
|
||||
@@ -116,11 +105,9 @@ def test_PathEffect_points_to_pixels():
|
||||
pe_renderer.points_to_pixels(15))
|
||||
|
||||
|
||||
-def test_SimplePatchShadow_offset_xy():
|
||||
- with mock.patch('matplotlib.cbook.deprecated') as dep:
|
||||
- pe = path_effects.SimplePatchShadow(offset_xy=(4, 5))
|
||||
+def test_SimplePatchShadow_offset():
|
||||
+ pe = path_effects.SimplePatchShadow(offset=(4, 5))
|
||||
assert_equal(pe._offset, (4, 5))
|
||||
- dep.assert_called()
|
||||
|
||||
|
||||
@image_comparison(baseline_images=['collection'])
|
||||
@@ -126,6 +126,10 @@ use_setup() {
|
||||
fi
|
||||
}
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-backport-GH5291-2462.patch
|
||||
)
|
||||
|
||||
python_prepare_all() {
|
||||
# Generates test failures, but fedora does it
|
||||
# local PATCHES=(
|
||||
|
||||
@@ -39,6 +39,7 @@ REQUIRED_USE="
|
||||
# #456704 -- a lot of py2-only deps
|
||||
PY2_USEDEP=$(python_gen_usedep python2_7)
|
||||
COMMON_DEPEND="
|
||||
dev-python/cycler[${PYTHON_USEDEP}]
|
||||
>=dev-python/numpy-1.6[${PYTHON_USEDEP}]
|
||||
dev-python/python-dateutil:0[${PYTHON_USEDEP}]
|
||||
dev-python/pytz[${PYTHON_USEDEP}]
|
||||
|
||||
Reference in New Issue
Block a user