File tree 2 files changed +17
-1
lines changed
Filter options
2 files changed +17
-1
lines changed
Original file line number Diff line number Diff line change @@ -667,6 +667,13 @@ def test_contains_branch(self):
667
667
668
668
assert not self .stack1 .contains_branch (self .tn1 + self .ta2 )
669
669
670
+ blend = mtransforms .BlendedGenericTransform (self .tn2 , self .stack2 )
671
+ x , y = blend .contains_branch_seperately (self .stack2_subset )
672
+ stack_blend = self .tn3 + blend
673
+ sx , sy = stack_blend .contains_branch_seperately (self .stack2_subset )
674
+ assert x is sx is False
675
+ assert y is sy is True
676
+
670
677
def test_affine_simplification (self ):
671
678
# tests that a transform stack only calls as much is absolutely
672
679
# necessary "non-affine" allowing the best possible optimization with
Original file line number Diff line number Diff line change @@ -1423,7 +1423,7 @@ def contains_branch_seperately(self, other_transform):
1423
1423
'transforms with 2 output dimensions' )
1424
1424
# for a non-blended transform each separate dimension is the same, so
1425
1425
# just return the appropriate shape.
1426
- return [ self .contains_branch (other_transform )] * 2
1426
+ return ( self .contains_branch (other_transform ), ) * 2
1427
1427
1428
1428
def __sub__ (self , other ):
1429
1429
"""
@@ -2404,6 +2404,15 @@ def _iter_break_from_left_to_right(self):
2404
2404
for left , right in self ._b ._iter_break_from_left_to_right ():
2405
2405
yield self ._a + left , right
2406
2406
2407
+ def contains_branch_seperately (self , other_transform ):
2408
+ # docstring inherited
2409
+ if self .output_dims != 2 :
2410
+ raise ValueError ('contains_branch_seperately only supports '
2411
+ 'transforms with 2 output dimensions' )
2412
+ if self == other_transform :
2413
+ return (True , True )
2414
+ return self ._b .contains_branch_seperately (other_transform )
2415
+
2407
2416
depth = property (lambda self : self ._a .depth + self ._b .depth )
2408
2417
is_affine = property (lambda self : self ._a .is_affine and self ._b .is_affine )
2409
2418
is_separable = property (
You can’t perform that action at this time.
0 commit comments