@@ -424,6 +424,12 @@ def test_slice_select_none(
424424 assume (step != 0 )
425425 self .check_slice (cls , values , start , stop , step , cow )
426426
427+ def test_get_slice_large_span (self ) -> None :
428+ # Regression for https://github.com/Ezibenroc/PyRoaringBitMap/issues/145
429+ bm = BitMap ([0 , 2 ** 31 - 1 if is_32_bits else 2 ** 63 - 1 ])
430+ assert bm [:] == bm
431+ assert bm [::- 1 ] == bm
432+
427433 @given (bitmap_cls , hyp_collection , st .booleans ())
428434 def test_simple_rank (
429435 self ,
@@ -1821,21 +1827,6 @@ def test_small_list(self, cls: type[EitherBitMap], collection: list[int]) -> Non
18211827 string_repr = string_repr .replace ("BitMap64" , "BitMap" ) # we redefined BitMap64 to BitMap at the top of this file
18221828 assert bm == eval (string_repr )
18231829
1824- def test_large_range_repr_32bit (self ) -> None :
1825- # Regression test for https://github.com/Ezibenroc/PyRoaringBitMap/issues/145
1826- # len(range(first_elt, last_elt+1)) overflows Py_ssize_t on 32-bit platforms.
1827- ns = {"BitMap" : pyroaring .BitMap }
1828- bm = pyroaring .BitMap ([0 , 2 ** 31 - 1 ])
1829- assert bm == eval (repr (bm ), ns )
1830- bm = pyroaring .BitMap ([0 , 2 ** 32 - 1 ])
1831- assert bm == eval (repr (bm ), ns )
1832-
1833- def test_large_range_repr_64bit (self ) -> None :
1834- # Same overflow, latent on 64-bit: a BitMap64 spanning [0, 2**63-1] also
1835- # overflows Py_ssize_t even on 64-bit platforms.
1836- bm = pyroaring .BitMap64 ([0 , 2 ** 63 - 1 ])
1837- assert bm == eval (repr (bm ), {"BitMap64" : pyroaring .BitMap64 })
1838-
18391830 @settings (suppress_health_check = HealthCheck )
18401831 @given (bitmap_cls , large_list_of_uin32 )
18411832 def test_large_list (self , cls : type [EitherBitMap ], collection : list [int ]) -> None :
0 commit comments