@@ -2569,7 +2569,7 @@ def test_get_bounding_rects(self):
25692569 @unittest .skipIf (IS_PYPY , "Segfaults on pypy" )
25702570 def test_to_surface (self ):
25712571 """Ensures empty and full masks can be drawn onto surfaces."""
2572- expected_ref_count = 3
2572+ expected_ref_count = ( 2 , 3 )
25732573 size = (33 , 65 )
25742574 surface = pygame .Surface (size , SRCALPHA , 32 )
25752575 surface_color = pygame .Color ("red" )
@@ -2583,13 +2583,13 @@ def test_to_surface(self):
25832583
25842584 self .assertIs (to_surface , surface )
25852585 if not IS_PYPY :
2586- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2586+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
25872587 self .assertEqual (to_surface .get_size (), size )
25882588 assertSurfaceFilled (self , to_surface , expected_color )
25892589
25902590 def test_to_surface__create_surface (self ):
25912591 """Ensures empty and full masks can be drawn onto a created surface."""
2592- expected_ref_count = 2
2592+ expected_ref_count = ( 1 , 2 )
25932593 expected_flag = SRCALPHA
25942594 expected_depth = 32
25952595 size = (33 , 65 )
@@ -2606,15 +2606,15 @@ def test_to_surface__create_surface(self):
26062606
26072607 self .assertIsInstance (to_surface , pygame .Surface )
26082608 if not IS_PYPY :
2609- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2609+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
26102610 self .assertTrue (to_surface .get_flags () & expected_flag )
26112611 self .assertEqual (to_surface .get_bitsize (), expected_depth )
26122612 self .assertEqual (to_surface .get_size (), size )
26132613 assertSurfaceFilled (self , to_surface , expected_color )
26142614
26152615 def test_to_surface__surface_param (self ):
26162616 """Ensures to_surface accepts a surface arg/kwarg."""
2617- expected_ref_count = 4
2617+ expected_ref_count = ( 3 , 4 )
26182618 expected_color = pygame .Color ("white" )
26192619 surface_color = pygame .Color ("red" )
26202620 size = (5 , 3 )
@@ -2632,13 +2632,13 @@ def test_to_surface__surface_param(self):
26322632
26332633 self .assertIs (to_surface , surface )
26342634 if not IS_PYPY :
2635- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2635+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
26362636 self .assertEqual (to_surface .get_size (), size )
26372637 assertSurfaceFilled (self , to_surface , expected_color )
26382638
26392639 def test_to_surface__setsurface_param (self ):
26402640 """Ensures to_surface accepts a setsurface arg/kwarg."""
2641- expected_ref_count = 2
2641+ expected_ref_count = ( 1 , 2 )
26422642 expected_flag = SRCALPHA
26432643 expected_depth = 32
26442644 expected_color = pygame .Color ("red" )
@@ -2657,15 +2657,15 @@ def test_to_surface__setsurface_param(self):
26572657 self .assertIsInstance (to_surface , pygame .Surface )
26582658
26592659 if not IS_PYPY :
2660- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2660+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
26612661 self .assertTrue (to_surface .get_flags () & expected_flag )
26622662 self .assertEqual (to_surface .get_bitsize (), expected_depth )
26632663 self .assertEqual (to_surface .get_size (), size )
26642664 assertSurfaceFilled (self , to_surface , expected_color )
26652665
26662666 def test_to_surface__unsetsurface_param (self ):
26672667 """Ensures to_surface accepts a unsetsurface arg/kwarg."""
2668- expected_ref_count = 2
2668+ expected_ref_count = ( 1 , 2 )
26692669 expected_flag = SRCALPHA
26702670 expected_depth = 32
26712671 expected_color = pygame .Color ("red" )
@@ -2683,15 +2683,15 @@ def test_to_surface__unsetsurface_param(self):
26832683
26842684 self .assertIsInstance (to_surface , pygame .Surface )
26852685 if not IS_PYPY :
2686- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2686+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
26872687 self .assertTrue (to_surface .get_flags () & expected_flag )
26882688 self .assertEqual (to_surface .get_bitsize (), expected_depth )
26892689 self .assertEqual (to_surface .get_size (), size )
26902690 assertSurfaceFilled (self , to_surface , expected_color )
26912691
26922692 def test_to_surface__setcolor_param (self ):
26932693 """Ensures to_surface accepts a setcolor arg/kwarg."""
2694- expected_ref_count = 2
2694+ expected_ref_count = ( 1 , 2 )
26952695 expected_flag = SRCALPHA
26962696 expected_depth = 32
26972697 expected_color = pygame .Color ("red" )
@@ -2707,7 +2707,7 @@ def test_to_surface__setcolor_param(self):
27072707
27082708 self .assertIsInstance (to_surface , pygame .Surface )
27092709 if not IS_PYPY :
2710- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2710+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
27112711 self .assertTrue (to_surface .get_flags () & expected_flag )
27122712 self .assertEqual (to_surface .get_bitsize (), expected_depth )
27132713 self .assertEqual (to_surface .get_size (), size )
@@ -2728,7 +2728,7 @@ def test_to_surface__setcolor_default(self):
27282728
27292729 def test_to_surface__unsetcolor_param (self ):
27302730 """Ensures to_surface accepts an unsetcolor arg/kwarg."""
2731- expected_ref_count = 2
2731+ expected_ref_count = ( 1 , 2 )
27322732 expected_flag = SRCALPHA
27332733 expected_depth = 32
27342734 expected_color = pygame .Color ("red" )
@@ -2746,7 +2746,7 @@ def test_to_surface__unsetcolor_param(self):
27462746
27472747 self .assertIsInstance (to_surface , pygame .Surface )
27482748 if not IS_PYPY :
2749- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2749+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
27502750 self .assertTrue (to_surface .get_flags () & expected_flag )
27512751 self .assertEqual (to_surface .get_bitsize (), expected_depth )
27522752 self .assertEqual (to_surface .get_size (), size )
@@ -2767,7 +2767,7 @@ def test_to_surface__unsetcolor_default(self):
27672767
27682768 def test_to_surface__dest_param (self ):
27692769 """Ensures to_surface accepts a dest arg/kwarg."""
2770- expected_ref_count = 2
2770+ expected_ref_count = ( 1 , 2 )
27712771 expected_flag = SRCALPHA
27722772 expected_depth = 32
27732773 default_surface_color = (0 , 0 , 0 , 0 )
@@ -2791,7 +2791,7 @@ def test_to_surface__dest_param(self):
27912791
27922792 self .assertIsInstance (to_surface , pygame .Surface )
27932793 if not IS_PYPY :
2794- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2794+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
27952795 self .assertTrue (to_surface .get_flags () & expected_flag )
27962796 self .assertEqual (to_surface .get_bitsize (), expected_depth )
27972797 self .assertEqual (to_surface .get_size (), size )
@@ -2822,7 +2822,7 @@ def test_to_surface__dest_default(self):
28222822
28232823 def test_to_surface__area_param (self ):
28242824 """Ensures to_surface accepts an area arg/kwarg."""
2825- expected_ref_count = 2
2825+ expected_ref_count = ( 1 , 2 )
28262826 expected_flag = SRCALPHA
28272827 expected_depth = 32
28282828 default_surface_color = (0 , 0 , 0 , 0 )
@@ -2845,7 +2845,7 @@ def test_to_surface__area_param(self):
28452845
28462846 self .assertIsInstance (to_surface , pygame .Surface )
28472847 if not IS_PYPY :
2848- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2848+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
28492849 self .assertTrue (to_surface .get_flags () & expected_flag )
28502850 self .assertEqual (to_surface .get_bitsize (), expected_depth )
28512851 self .assertEqual (to_surface .get_size (), size )
@@ -3594,7 +3594,7 @@ def test_to_surface__default_surface_with_param_combinations(self):
35943594 This tests many parameter combinations with full and empty
35953595 masks.
35963596 """
3597- expected_ref_count = 2
3597+ expected_ref_count = ( 1 , 2 )
35983598 expected_flag = SRCALPHA
35993599 expected_depth = 32
36003600 size = (5 , 3 )
@@ -3661,7 +3661,7 @@ def test_to_surface__default_surface_with_param_combinations(self):
36613661
36623662 self .assertIsInstance (to_surface , pygame .Surface )
36633663 if not IS_PYPY :
3664- self .assertEqual (
3664+ self .assertIn (
36653665 sys .getrefcount (to_surface ), expected_ref_count
36663666 )
36673667 self .assertTrue (to_surface .get_flags () & expected_flag )
@@ -3678,7 +3678,7 @@ def test_to_surface__surface_with_param_combinations(self):
36783678 This tests many parameter combinations with full and empty
36793679 masks.
36803680 """
3681- expected_ref_count = 4
3681+ expected_ref_count = ( 3 , 4 )
36823682 expected_flag = SRCALPHA
36833683 expected_depth = 32
36843684 size = (5 , 3 )
@@ -3748,7 +3748,7 @@ def test_to_surface__surface_with_param_combinations(self):
37483748
37493749 self .assertIs (to_surface , surface )
37503750 if not IS_PYPY :
3751- self .assertEqual (
3751+ self .assertIn (
37523752 sys .getrefcount (to_surface ), expected_ref_count
37533753 )
37543754 self .assertTrue (to_surface .get_flags () & expected_flag )
@@ -5529,7 +5529,7 @@ def test_to_surface__area_off_mask_with_setsurface_unsetsurface(self):
55295529
55305530 def test_to_surface__surface_with_zero_size (self ):
55315531 """Ensures zero sized surfaces are handled correctly."""
5532- expected_ref_count = 3
5532+ expected_ref_count = ( 2 , 3 )
55335533 size = (0 , 0 )
55345534 surface = pygame .Surface (size )
55355535 mask = pygame .mask .Mask ((3 , 4 ), fill = True )
@@ -5538,12 +5538,12 @@ def test_to_surface__surface_with_zero_size(self):
55385538
55395539 self .assertIs (to_surface , surface )
55405540 if not IS_PYPY :
5541- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5541+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
55425542 self .assertEqual (to_surface .get_size (), size )
55435543
55445544 def test_to_surface__setsurface_with_zero_size (self ):
55455545 """Ensures zero sized setsurfaces are handled correctly."""
5546- expected_ref_count = 2
5546+ expected_ref_count = ( 1 , 2 )
55475547 expected_flag = SRCALPHA
55485548 expected_depth = 32
55495549 expected_color = pygame .Color ("white" ) # Default setcolor.
@@ -5555,15 +5555,15 @@ def test_to_surface__setsurface_with_zero_size(self):
55555555
55565556 self .assertIsInstance (to_surface , pygame .Surface )
55575557 if not IS_PYPY :
5558- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5558+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
55595559 self .assertTrue (to_surface .get_flags () & expected_flag )
55605560 self .assertEqual (to_surface .get_bitsize (), expected_depth )
55615561 self .assertEqual (to_surface .get_size (), mask_size )
55625562 assertSurfaceFilled (self , to_surface , expected_color )
55635563
55645564 def test_to_surface__unsetsurface_with_zero_size (self ):
55655565 """Ensures zero sized unsetsurfaces are handled correctly."""
5566- expected_ref_count = 2
5566+ expected_ref_count = ( 1 , 2 )
55675567 expected_flag = SRCALPHA
55685568 expected_depth = 32
55695569 expected_color = pygame .Color ("black" ) # Default unsetcolor.
@@ -5575,7 +5575,7 @@ def test_to_surface__unsetsurface_with_zero_size(self):
55755575
55765576 self .assertIsInstance (to_surface , pygame .Surface )
55775577 if not IS_PYPY :
5578- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5578+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
55795579 self .assertTrue (to_surface .get_flags () & expected_flag )
55805580 self .assertEqual (to_surface .get_bitsize (), expected_depth )
55815581 self .assertEqual (to_surface .get_size (), mask_size )
0 commit comments