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 fad4ead

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

File tree

1 file changed

+21
-0
lines changed
Filter options

1 file changed

+21
-0
lines changed

‎lib/matplotlib/tests/test_transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_transforms.py
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,27 @@ 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+
# Translation and skew present
353+
base = mtransforms.Affine2D.from_values(1, 5, 4, 1, 2, 3)
354+
t = mtransforms.AffineDeltaTransform(base)
355+
assert_array_equal(t.get_matrix(), before)
356+
# Mess with the internal structure of `base` without invalidating
357+
base.get_matrix()[0, 1:] = 3
358+
assert_array_equal(t.get_matrix(), before)
359+
360+
# Invalidate the base
361+
base.invalidate()
362+
assert_array_equal(t.get_matrix(), after)
363+
364+
344365
def test_non_affine_caching():
345366
class AssertingNonAffineTransform(mtransforms.Transform):
346367
"""

0 commit comments

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