Skip to content

Commit 700efaa

Browse files
committed
General test cleanups
1 parent a64b71c commit 700efaa

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

hypothesis-python/tests/cover/test_regex.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ def test_fullmatch_generates_example(pattern, matching_str):
429429
find_any(
430430
st.from_regex(pattern, fullmatch=True),
431431
lambda s: s == matching_str,
432-
settings(max_examples=10**6),
433432
)
434433

435434

hypothesis-python/tests/nocover/test_complex_numbers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
import pytest
1212

13-
from hypothesis import given, settings, strategies as st
13+
from hypothesis import given, strategies as st
1414

1515

1616
@pytest.mark.parametrize("width", [32, 64, 128])
1717
@pytest.mark.parametrize("keyword", ["min_magnitude", "max_magnitude"])
1818
@given(data=st.data())
19-
@settings(max_examples=1000)
2019
def test_magnitude_validates(width, keyword, data):
2120
# See https://github.com/HypothesisWorks/hypothesis/issues/3573
2221
component_width = width / 2

hypothesis-python/tests/nocover/test_database_usage.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,18 @@ def condition(x):
100100
invalid.add(value)
101101
with deterministic_PRNG():
102102
stuff()
103-
104103
assert len(all_values(database)) < original
105104

106105

107106
def test_respects_max_examples_in_database_usage():
108107
key = b"a database key"
109108
database = InMemoryExampleDatabase()
110109
do_we_care = True
111-
counter = [0]
110+
counter = 0
112111

113112
def check(x):
114-
counter[0] += 1
113+
nonlocal counter
114+
counter += 1
115115
return do_we_care and has_a_non_zero_byte(x)
116116

117117
def stuff():
@@ -129,9 +129,10 @@ def stuff():
129129
stuff()
130130
assert len(all_values(database)) > 10
131131
do_we_care = False
132-
counter[0] = 0
133-
stuff()
134-
assert counter == [10]
132+
counter = 0
133+
with deterministic_PRNG():
134+
stuff()
135+
assert counter == 10
135136

136137

137138
def test_does_not_use_database_when_seed_is_forced(monkeypatch):

hypothesis-python/tests/numpy/test_from_dtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_is_t(x):
6969
test_is_t()
7070

7171

72-
@settings(max_examples=100)
72+
@settings(max_examples=100, deadline=None)
7373
@given(nps.nested_dtypes(max_itemsize=400), st.data())
7474
def test_infer_strategy_from_dtype(dtype, data):
7575
# Given a dtype

0 commit comments

Comments
 (0)