Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b91d8e

Browse files
committed
TST: Added a unit test to avoid CI problems
1 parent d73bd6d commit 0b91d8e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/matplotlib/tests/test_transforms.py

Lines 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)