MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_copy

Method test_copy

lib/matplotlib/tests/test_transforms.py:308–324  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

306 t.transform([[1, 2, 3]])
307
308 def test_copy(self):
309 a = mtransforms.Affine2D()
310 b = mtransforms.Affine2D()
311 s = a + b
312 # Updating a dependee should invalidate a copy of the dependent.
313 s.get_matrix() # resolve it.
314 s1 = copy.copy(s)
315 assert not s._invalid and not s1._invalid
316 a.translate(1, 2)
317 assert s._invalid and s1._invalid
318 assert (s1.get_matrix() == a.get_matrix()).all()
319 # Updating a copy of a dependee shouldn't invalidate a dependent.
320 s.get_matrix() # resolve it.
321 b1 = copy.copy(b)
322 b1.translate(3, 4)
323 assert not s._invalid
324 assert_array_equal(s.get_matrix(), a.get_matrix())
325
326 def test_deepcopy(self):
327 a = mtransforms.Affine2D()

Callers

nothing calls this directly

Calls 4

translateMethod · 0.95
get_matrixMethod · 0.95
get_matrixMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected