Skip to content

Commit c365a73

Browse files
committed
typing, tweak release notes
1 parent dc217a6 commit c365a73

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

hypothesis-python/RELEASE.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ RELEASE_TYPE: minor
1515
# ...and these two.
1616
settings(suppress_health_check=[HealthCheck.filter_too_much])
1717
settings(suppress_health_check=["filter_too_much"])
18+
19+
This release also changes the canonical value of |Verbosity|, |Phase|, and |HealthCheck| members to a string instead of an integer. For example, ``Phase.reuse.value == "explicit"`` as of this release, where previously ``Phase.reuse.value == 1``.
20+
21+
Instantiating |Verbosity|, |Phase|, or |HealthCheck| with an integer, such as ``Verbosity(0)``, is now deprecated.

hypothesis-python/src/hypothesis/_settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ def _int_value(value: "Verbosity") -> int:
123123
assert list(mapping.keys()) == [verbosity.name for verbosity in Verbosity]
124124
return mapping[value.name]
125125

126-
def __eq__(self, other):
126+
def __eq__(self, other: Any) -> bool:
127127
if isinstance(other, Verbosity):
128128
return super().__eq__(other)
129129
return Verbosity._int_value(self) == other
130130

131-
def __gt__(self, other):
131+
def __gt__(self, other: Any) -> bool:
132132
value1 = Verbosity._int_value(self)
133133
value2 = Verbosity._int_value(other) if isinstance(other, Verbosity) else other
134134
return value1 > value2
@@ -419,7 +419,7 @@ def _validate_choices(name: str, value: T, *, choices: Sequence[object]) -> T:
419419
return value
420420

421421

422-
def _validate_enum_value(cls: type, value: object, *, name) -> Any:
422+
def _validate_enum_value(cls: Any, value: object, *, name: str) -> Any:
423423
try:
424424
return cls(value)
425425
except ValueError:
@@ -471,7 +471,7 @@ def _validate_stateful_step_count(stateful_step_count: int) -> int:
471471
return stateful_step_count
472472

473473

474-
def _validate_suppress_health_check(suppressions: object):
474+
def _validate_suppress_health_check(suppressions: object) -> tuple[HealthCheck, ...]:
475475
suppressions = try_convert(tuple, suppressions, "suppress_health_check")
476476
for health_check in suppressions:
477477
if health_check in (HealthCheck.return_value, HealthCheck.not_a_test_method):

0 commit comments

Comments
 (0)