@@ -2569,7 +2569,7 @@ def test_get_bounding_rects(self):
2569
2569
@unittest .skipIf (IS_PYPY , "Segfaults on pypy" )
2570
2570
def test_to_surface (self ):
2571
2571
"""Ensures empty and full masks can be drawn onto surfaces."""
2572
- expected_ref_count = 3
2572
+ expected_ref_count = ( 2 , 3 )
2573
2573
size = (33 , 65 )
2574
2574
surface = pygame .Surface (size , SRCALPHA , 32 )
2575
2575
surface_color = pygame .Color ("red" )
@@ -2583,13 +2583,13 @@ def test_to_surface(self):
2583
2583
2584
2584
self .assertIs (to_surface , surface )
2585
2585
if not IS_PYPY :
2586
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2586
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2587
2587
self .assertEqual (to_surface .get_size (), size )
2588
2588
assertSurfaceFilled (self , to_surface , expected_color )
2589
2589
2590
2590
def test_to_surface__create_surface (self ):
2591
2591
"""Ensures empty and full masks can be drawn onto a created surface."""
2592
- expected_ref_count = 2
2592
+ expected_ref_count = ( 1 , 2 )
2593
2593
expected_flag = SRCALPHA
2594
2594
expected_depth = 32
2595
2595
size = (33 , 65 )
@@ -2606,15 +2606,15 @@ def test_to_surface__create_surface(self):
2606
2606
2607
2607
self .assertIsInstance (to_surface , pygame .Surface )
2608
2608
if not IS_PYPY :
2609
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2609
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2610
2610
self .assertTrue (to_surface .get_flags () & expected_flag )
2611
2611
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2612
2612
self .assertEqual (to_surface .get_size (), size )
2613
2613
assertSurfaceFilled (self , to_surface , expected_color )
2614
2614
2615
2615
def test_to_surface__surface_param (self ):
2616
2616
"""Ensures to_surface accepts a surface arg/kwarg."""
2617
- expected_ref_count = 4
2617
+ expected_ref_count = ( 3 , 4 )
2618
2618
expected_color = pygame .Color ("white" )
2619
2619
surface_color = pygame .Color ("red" )
2620
2620
size = (5 , 3 )
@@ -2632,13 +2632,13 @@ def test_to_surface__surface_param(self):
2632
2632
2633
2633
self .assertIs (to_surface , surface )
2634
2634
if not IS_PYPY :
2635
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2635
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2636
2636
self .assertEqual (to_surface .get_size (), size )
2637
2637
assertSurfaceFilled (self , to_surface , expected_color )
2638
2638
2639
2639
def test_to_surface__setsurface_param (self ):
2640
2640
"""Ensures to_surface accepts a setsurface arg/kwarg."""
2641
- expected_ref_count = 2
2641
+ expected_ref_count = ( 1 , 2 )
2642
2642
expected_flag = SRCALPHA
2643
2643
expected_depth = 32
2644
2644
expected_color = pygame .Color ("red" )
@@ -2657,15 +2657,15 @@ def test_to_surface__setsurface_param(self):
2657
2657
self .assertIsInstance (to_surface , pygame .Surface )
2658
2658
2659
2659
if not IS_PYPY :
2660
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2660
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2661
2661
self .assertTrue (to_surface .get_flags () & expected_flag )
2662
2662
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2663
2663
self .assertEqual (to_surface .get_size (), size )
2664
2664
assertSurfaceFilled (self , to_surface , expected_color )
2665
2665
2666
2666
def test_to_surface__unsetsurface_param (self ):
2667
2667
"""Ensures to_surface accepts a unsetsurface arg/kwarg."""
2668
- expected_ref_count = 2
2668
+ expected_ref_count = ( 1 , 2 )
2669
2669
expected_flag = SRCALPHA
2670
2670
expected_depth = 32
2671
2671
expected_color = pygame .Color ("red" )
@@ -2683,15 +2683,15 @@ def test_to_surface__unsetsurface_param(self):
2683
2683
2684
2684
self .assertIsInstance (to_surface , pygame .Surface )
2685
2685
if not IS_PYPY :
2686
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2686
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2687
2687
self .assertTrue (to_surface .get_flags () & expected_flag )
2688
2688
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2689
2689
self .assertEqual (to_surface .get_size (), size )
2690
2690
assertSurfaceFilled (self , to_surface , expected_color )
2691
2691
2692
2692
def test_to_surface__setcolor_param (self ):
2693
2693
"""Ensures to_surface accepts a setcolor arg/kwarg."""
2694
- expected_ref_count = 2
2694
+ expected_ref_count = ( 1 , 2 )
2695
2695
expected_flag = SRCALPHA
2696
2696
expected_depth = 32
2697
2697
expected_color = pygame .Color ("red" )
@@ -2707,7 +2707,7 @@ def test_to_surface__setcolor_param(self):
2707
2707
2708
2708
self .assertIsInstance (to_surface , pygame .Surface )
2709
2709
if not IS_PYPY :
2710
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2710
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2711
2711
self .assertTrue (to_surface .get_flags () & expected_flag )
2712
2712
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2713
2713
self .assertEqual (to_surface .get_size (), size )
@@ -2728,7 +2728,7 @@ def test_to_surface__setcolor_default(self):
2728
2728
2729
2729
def test_to_surface__unsetcolor_param (self ):
2730
2730
"""Ensures to_surface accepts an unsetcolor arg/kwarg."""
2731
- expected_ref_count = 2
2731
+ expected_ref_count = ( 1 , 2 )
2732
2732
expected_flag = SRCALPHA
2733
2733
expected_depth = 32
2734
2734
expected_color = pygame .Color ("red" )
@@ -2746,7 +2746,7 @@ def test_to_surface__unsetcolor_param(self):
2746
2746
2747
2747
self .assertIsInstance (to_surface , pygame .Surface )
2748
2748
if not IS_PYPY :
2749
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2749
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2750
2750
self .assertTrue (to_surface .get_flags () & expected_flag )
2751
2751
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2752
2752
self .assertEqual (to_surface .get_size (), size )
@@ -2767,7 +2767,7 @@ def test_to_surface__unsetcolor_default(self):
2767
2767
2768
2768
def test_to_surface__dest_param (self ):
2769
2769
"""Ensures to_surface accepts a dest arg/kwarg."""
2770
- expected_ref_count = 2
2770
+ expected_ref_count = ( 1 , 2 )
2771
2771
expected_flag = SRCALPHA
2772
2772
expected_depth = 32
2773
2773
default_surface_color = (0 , 0 , 0 , 0 )
@@ -2791,7 +2791,7 @@ def test_to_surface__dest_param(self):
2791
2791
2792
2792
self .assertIsInstance (to_surface , pygame .Surface )
2793
2793
if not IS_PYPY :
2794
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2794
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2795
2795
self .assertTrue (to_surface .get_flags () & expected_flag )
2796
2796
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2797
2797
self .assertEqual (to_surface .get_size (), size )
@@ -2822,7 +2822,7 @@ def test_to_surface__dest_default(self):
2822
2822
2823
2823
def test_to_surface__area_param (self ):
2824
2824
"""Ensures to_surface accepts an area arg/kwarg."""
2825
- expected_ref_count = 2
2825
+ expected_ref_count = ( 1 , 2 )
2826
2826
expected_flag = SRCALPHA
2827
2827
expected_depth = 32
2828
2828
default_surface_color = (0 , 0 , 0 , 0 )
@@ -2845,7 +2845,7 @@ def test_to_surface__area_param(self):
2845
2845
2846
2846
self .assertIsInstance (to_surface , pygame .Surface )
2847
2847
if not IS_PYPY :
2848
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
2848
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
2849
2849
self .assertTrue (to_surface .get_flags () & expected_flag )
2850
2850
self .assertEqual (to_surface .get_bitsize (), expected_depth )
2851
2851
self .assertEqual (to_surface .get_size (), size )
@@ -3594,7 +3594,7 @@ def test_to_surface__default_surface_with_param_combinations(self):
3594
3594
This tests many parameter combinations with full and empty
3595
3595
masks.
3596
3596
"""
3597
- expected_ref_count = 2
3597
+ expected_ref_count = ( 1 , 2 )
3598
3598
expected_flag = SRCALPHA
3599
3599
expected_depth = 32
3600
3600
size = (5 , 3 )
@@ -3661,7 +3661,7 @@ def test_to_surface__default_surface_with_param_combinations(self):
3661
3661
3662
3662
self .assertIsInstance (to_surface , pygame .Surface )
3663
3663
if not IS_PYPY :
3664
- self .assertEqual (
3664
+ self .assertIn (
3665
3665
sys .getrefcount (to_surface ), expected_ref_count
3666
3666
)
3667
3667
self .assertTrue (to_surface .get_flags () & expected_flag )
@@ -3678,7 +3678,7 @@ def test_to_surface__surface_with_param_combinations(self):
3678
3678
This tests many parameter combinations with full and empty
3679
3679
masks.
3680
3680
"""
3681
- expected_ref_count = 4
3681
+ expected_ref_count = ( 3 , 4 )
3682
3682
expected_flag = SRCALPHA
3683
3683
expected_depth = 32
3684
3684
size = (5 , 3 )
@@ -3748,7 +3748,7 @@ def test_to_surface__surface_with_param_combinations(self):
3748
3748
3749
3749
self .assertIs (to_surface , surface )
3750
3750
if not IS_PYPY :
3751
- self .assertEqual (
3751
+ self .assertIn (
3752
3752
sys .getrefcount (to_surface ), expected_ref_count
3753
3753
)
3754
3754
self .assertTrue (to_surface .get_flags () & expected_flag )
@@ -5529,7 +5529,7 @@ def test_to_surface__area_off_mask_with_setsurface_unsetsurface(self):
5529
5529
5530
5530
def test_to_surface__surface_with_zero_size (self ):
5531
5531
"""Ensures zero sized surfaces are handled correctly."""
5532
- expected_ref_count = 3
5532
+ expected_ref_count = ( 2 , 3 )
5533
5533
size = (0 , 0 )
5534
5534
surface = pygame .Surface (size )
5535
5535
mask = pygame .mask .Mask ((3 , 4 ), fill = True )
@@ -5538,12 +5538,12 @@ def test_to_surface__surface_with_zero_size(self):
5538
5538
5539
5539
self .assertIs (to_surface , surface )
5540
5540
if not IS_PYPY :
5541
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5541
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
5542
5542
self .assertEqual (to_surface .get_size (), size )
5543
5543
5544
5544
def test_to_surface__setsurface_with_zero_size (self ):
5545
5545
"""Ensures zero sized setsurfaces are handled correctly."""
5546
- expected_ref_count = 2
5546
+ expected_ref_count = ( 1 , 2 )
5547
5547
expected_flag = SRCALPHA
5548
5548
expected_depth = 32
5549
5549
expected_color = pygame .Color ("white" ) # Default setcolor.
@@ -5555,15 +5555,15 @@ def test_to_surface__setsurface_with_zero_size(self):
5555
5555
5556
5556
self .assertIsInstance (to_surface , pygame .Surface )
5557
5557
if not IS_PYPY :
5558
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5558
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
5559
5559
self .assertTrue (to_surface .get_flags () & expected_flag )
5560
5560
self .assertEqual (to_surface .get_bitsize (), expected_depth )
5561
5561
self .assertEqual (to_surface .get_size (), mask_size )
5562
5562
assertSurfaceFilled (self , to_surface , expected_color )
5563
5563
5564
5564
def test_to_surface__unsetsurface_with_zero_size (self ):
5565
5565
"""Ensures zero sized unsetsurfaces are handled correctly."""
5566
- expected_ref_count = 2
5566
+ expected_ref_count = ( 1 , 2 )
5567
5567
expected_flag = SRCALPHA
5568
5568
expected_depth = 32
5569
5569
expected_color = pygame .Color ("black" ) # Default unsetcolor.
@@ -5575,7 +5575,7 @@ def test_to_surface__unsetsurface_with_zero_size(self):
5575
5575
5576
5576
self .assertIsInstance (to_surface , pygame .Surface )
5577
5577
if not IS_PYPY :
5578
- self .assertEqual (sys .getrefcount (to_surface ), expected_ref_count )
5578
+ self .assertIn (sys .getrefcount (to_surface ), expected_ref_count )
5579
5579
self .assertTrue (to_surface .get_flags () & expected_flag )
5580
5580
self .assertEqual (to_surface .get_bitsize (), expected_depth )
5581
5581
self .assertEqual (to_surface .get_size (), mask_size )
0 commit comments