Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58379e3

Browse filesBrowse files
committed
TST: Added a unit test to avoid CI problems
1 parent 5ee9780 commit 58379e3
Copy full SHA for 58379e3

File tree

1 file changed

+25
-0
lines changed
Filter options

1 file changed

+25
-0
lines changed

‎lib/matplotlib/tests/test_transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_transforms.py
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,31 @@ def test_deepcopy(self):
341341
assert_array_equal(s.get_matrix(), a.get_matrix())
342342

343343

344+
class TestAffineDeltaTransform:
345+
def test_invalidate(self):
346+
before = np.array([[1.0, 4.0, 0.0],
347+
[5.0, 1.0, 0.0],
348+
[0.0, 0.0, 1.0]])
349+
after = np.array([[1.0, 3.0, 0.0],
350+
[5.0, 1.0, 0.0],
351+
[0.0, 0.0, 1.0]])
352+
353+
# Translation and skew present
354+
base = mtransforms.Affine2D.from_values(1, 5, 4, 1, 2, 3)
355+
t = mtransforms.AffineDeltaTransform(base)
356+
assert_array_equal(t.get_matrix(), before)
357+
358+
# Mess with the internal structure of `base` without invalidating
359+
# This should not affect this transform because it's a passthrough:
360+
# it's always invalid
361+
base.get_matrix()[0, 1:] = 3
362+
assert_array_equal(t.get_matrix(), after)
363+
364+
# Invalidate the base
365+
base.invalidate()
366+
assert_array_equal(t.get_matrix(), after)
367+
368+
344369
def test_non_affine_caching():
345370
class AssertingNonAffineTransform(mtransforms.Transform):
346371
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.