@@ -250,9 +250,9 @@ def test_chop_gravity():
250250 with Image (filename = 'rose:' ) as img :
251251 img .chop (width = 10 , height = 10 , gravity = 'south_east' )
252252 assert (60 , 36 , 0 , 0 ) == img .page
253- with raises ( ValueError ) :
254- with Image ( filename = 'rose:' ) as img :
255- img . chop ( x = 10 , gravity = 'north' )
253+ with Image ( filename = 'rose:' ) as img :
254+ img . chop ( width = 10 , height = 10 , x = 10 , y = 10 , gravity = 'north' )
255+ assert ( 60 , 36 , 0 , 0 ) == img . page
256256
257257
258258@mark .skipif (MAGICK_VERSION_NUMBER < 0x709 ,
@@ -660,14 +660,6 @@ def test_crop_gravity(fx_asset):
660660 assert southeast [mid_width , mid_height ] == Color ('transparent' )
661661
662662
663- def test_crop_gravity_error ():
664- with Image (filename = 'rose:' ) as img :
665- with raises (TypeError ):
666- img .crop (gravity = 'center' )
667- with raises (ValueError ):
668- img .crop (width = 1 , height = 1 , gravity = 'nowhere' )
669-
670-
671663def test_crop_issue367 ():
672664 with Image (filename = 'rose:' ) as img :
673665 expected = img .size
@@ -679,6 +671,12 @@ def test_crop_issue367():
679671 assert actual .size == expected
680672
681673
674+ def test_crop_issue669 ():
675+ with Image (filename = 'rose:' ) as img :
676+ img .crop (width = 50 , height = 25 , left = 10 , gravity = 'south' )
677+ assert 50 , 25 == img .size
678+
679+
682680def test_cycle_color_map (fx_asset ):
683681 with Image (filename = str (fx_asset .joinpath ('trim-color-test.png' ))) as img :
684682 img .type = 'palette'
@@ -874,9 +872,9 @@ def test_extent_gravity():
874872 assert (10 , 10 , 0 , 0 ) == img .page
875873 img .extent (width = 100 , height = 100 , gravity = 'center' )
876874 assert (100 , 100 , 0 , 0 ) == img .page
877- with raises ( ValueError ) :
878- with Image ( filename = 'rose:' ) as img :
879- img .extent ( x = 10 , gravity = 'north' )
875+ with Image ( filename = 'rose:' ) as img :
876+ img . extent ( x = 10 , gravity = 'north' )
877+ assert 70 , 46 == img .size
880878
881879
882880def test_features ():
@@ -1730,10 +1728,10 @@ def test_region():
17301728 with src .region (width = 10 , height = 10 , gravity = 'south_east' ) as dst :
17311729 assert (70 , 46 , 60 , 36 ) == dst .page
17321730 assert (10 , 10 ) == dst .size
1733- with raises ( ValueError ) :
1734- with Image ( filename = 'rose: ' ) as img :
1735- with img . region ( x = 10 , gravity = 'center' ) as _ :
1736- pass
1731+ with Image ( filename = 'rose:' ) as img :
1732+ with img . region ( x = 10 , gravity = 'center ' ) as dst :
1733+ assert ( 70 , 46 , 10 , 0 ) == dst . page
1734+ assert ( 60 , 46 ) == dst . size
17371735
17381736
17391737def test_remap ():
@@ -2155,9 +2153,9 @@ def test_splice():
21552153 was = img .signature
21562154 img .splice (width = 10 , height = 10 , gravity = 'center' )
21572155 assert img .signature != was
2158- with raises ( ValueError ) :
2159- with Image ( filename = 'rose:' ) as img :
2160- img . splice ( width = 10 , height = 10 , x = 10 , gravity = 'center' )
2156+ with Image ( filename = 'rose:' ) as img :
2157+ img . splice ( width = 10 , height = 10 , x = 10 , gravity = 'center' )
2158+ assert ( 80 , 56 ) == img . size
21612159
21622160
21632161def test_spread ():
0 commit comments