|
1 | | -import copy |
2 | 1 | import re |
3 | 2 |
|
4 | 3 | import numpy as np |
@@ -333,8 +332,28 @@ def test_path_deepcopy(): |
333 | 332 | codes = [Path.MOVETO, Path.LINETO] |
334 | 333 | path1 = Path(verts) |
335 | 334 | path2 = Path(verts, codes) |
336 | | - copy.deepcopy(path1) |
337 | | - copy.deepcopy(path2) |
| 335 | + path1_copy = path1.deepcopy() |
| 336 | + path2_copy = path2.deepcopy() |
| 337 | + assert path1 is not path1_copy |
| 338 | + assert path1.vertices is not path1_copy.vertices |
| 339 | + assert path2 is not path2_copy |
| 340 | + assert path2.vertices is not path2_copy.vertices |
| 341 | + assert path2.codes is not path2_copy.codes |
| 342 | + |
| 343 | + |
| 344 | +def test_path_shallowcopy(): |
| 345 | + # Should not raise any error |
| 346 | + verts = [[0, 0], [1, 1]] |
| 347 | + codes = [Path.MOVETO, Path.LINETO] |
| 348 | + path1 = Path(verts) |
| 349 | + path2 = Path(verts, codes) |
| 350 | + path1_copy = path1.copy() |
| 351 | + path2_copy = path2.copy() |
| 352 | + assert path1 is not path1_copy |
| 353 | + assert path1.vertices is path1_copy.vertices |
| 354 | + assert path2 is not path2_copy |
| 355 | + assert path2.vertices is path2_copy.vertices |
| 356 | + assert path2.codes is path2_copy.codes |
338 | 357 |
|
339 | 358 |
|
340 | 359 | @pytest.mark.parametrize('phi', np.concatenate([ |
|
0 commit comments