54
54
nicerepr ,
55
55
proxies ,
56
56
required_args ,
57
- reserved_means_kwonly_star ,
58
57
)
59
58
from hypothesis .internal .validation import (
60
59
check_type ,
@@ -430,7 +429,7 @@ def floats(
430
429
Excluding either signed zero will also exclude the other.
431
430
Attempting to exclude an endpoint which is None will raise an error;
432
431
use ``allow_infinity=False`` to generate finite floats. You can however
433
- use e.g. ``min_value=float("- inf") , exclude_min=True`` to exclude only
432
+ use e.g. ``min_value=-math. inf, exclude_min=True`` to exclude only
434
433
one infinite endpoint.
435
434
436
435
Examples from this strategy have a complicated and hard to explain
@@ -481,9 +480,9 @@ def floats(
481
480
"%d - use max_value=%r instead" % (max_arg , width , max_value )
482
481
)
483
482
484
- if exclude_min and (min_value is None or min_value == float ( " inf" ) ):
483
+ if exclude_min and (min_value is None or min_value == math . inf ):
485
484
raise InvalidArgument ("Cannot exclude min_value=%r" % (min_value ,))
486
- if exclude_max and (max_value is None or max_value == float ( "- inf" ) ):
485
+ if exclude_max and (max_value is None or max_value == - math . inf ):
487
486
raise InvalidArgument ("Cannot exclude max_value=%r" % (max_value ,))
488
487
489
488
if min_value is not None and (
@@ -505,9 +504,9 @@ def floats(
505
504
max_value = next_down (max_value , width )
506
505
assert max_value < max_arg # type: ignore
507
506
508
- if min_value == float ( "- inf" ) :
507
+ if min_value == - math . inf :
509
508
min_value = None
510
- if max_value == float ( " inf" ) :
509
+ if max_value == math . inf :
511
510
max_value = None
512
511
513
512
bad_zero_bounds = (
@@ -538,9 +537,9 @@ def floats(
538
537
"Cannot have allow_infinity=%r, with both min_value and "
539
538
"max_value" % (allow_infinity )
540
539
)
541
- elif min_value == float ( " inf" ) :
540
+ elif min_value == math . inf :
542
541
raise InvalidArgument ("allow_infinity=False excludes min_value=inf" )
543
- elif max_value == float ( "- inf" ) :
542
+ elif max_value == - math . inf :
544
543
raise InvalidArgument ("allow_infinity=False excludes max_value=-inf" )
545
544
546
545
unbounded_floats = FloatStrategy (
@@ -837,11 +836,10 @@ def iterables(
837
836
838
837
839
838
@defines_strategy
840
- @reserved_means_kwonly_star
841
839
def fixed_dictionaries (
842
840
mapping , # type: Dict[T, SearchStrategy[Ex]]
843
- __reserved = not_set , # type: Any
844
- optional = None , # type: Dict[T, SearchStrategy[Ex]]
841
+ * ,
842
+ optional = None # type: Dict[T, SearchStrategy[Ex]]
845
843
):
846
844
# type: (...) -> SearchStrategy[Dict[T, Ex]]
847
845
"""Generates a dictionary of the same type as mapping with a fixed set of
@@ -858,8 +856,6 @@ def fixed_dictionaries(
858
856
check_type (dict , mapping , "mapping" )
859
857
for k , v in mapping .items ():
860
858
check_strategy (v , "mapping[%r]" % (k ,))
861
- if __reserved is not not_set :
862
- raise InvalidArgument ("Do not pass __reserved; got %r" % (__reserved ,))
863
859
if optional is not None :
864
860
check_type (dict , optional , "optional" )
865
861
for k , v in optional .items ():
@@ -1915,7 +1911,7 @@ def complex_numbers(
1915
1911
check_valid_magnitude (min_magnitude , "min_magnitude" )
1916
1912
check_valid_magnitude (max_magnitude , "max_magnitude" )
1917
1913
check_valid_interval (min_magnitude , max_magnitude , "min_magnitude" , "max_magnitude" )
1918
- if max_magnitude == float ( " inf" ) :
1914
+ if max_magnitude == math . inf :
1919
1915
max_magnitude = None
1920
1916
if min_magnitude == 0 :
1921
1917
min_magnitude = None
0 commit comments