Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Lib/test/support/hypothesis_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from test.support import mark

try:
import hypothesis
except ImportError:
Expand Down Expand Up @@ -51,3 +53,5 @@
),
)
hypothesis.settings.load_profile("cpython-local-dev")

mark_hypothesis = mark("hypothesis")
6 changes: 5 additions & 1 deletion Lib/test/test_binascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import array
import re
from test.support import bigmemtest, _1G, _4G
from test.support.hypothesis_helper import hypothesis
from test.support.hypothesis_helper import hypothesis, mark_hypothesis


# Note: "*_hex" functions are aliases for "(un)hexlify"
Expand Down Expand Up @@ -265,6 +265,7 @@ def test_uu(self):
binary=hypothesis.strategies.binary(max_size=45),
backtick=hypothesis.strategies.booleans(),
)
@mark_hypothesis
def test_b2a_roundtrip(self, binary, backtick):
converted = binascii.b2a_uu(self.type2test(binary), backtick=backtick)
restored = binascii.a2b_uu(self.type2test(converted))
Expand Down Expand Up @@ -308,6 +309,7 @@ def test_hex(self):
self.assertEqual(binascii.unhexlify(self.type2test(t)), u)

@hypothesis.given(binary=hypothesis.strategies.binary())
@mark_hypothesis
def test_hex_roundtrip(self, binary):
converted = binascii.hexlify(self.type2test(binary))
restored = binascii.unhexlify(self.type2test(converted))
Expand Down Expand Up @@ -433,6 +435,7 @@ def test_qp(self):
istext=hypothesis.strategies.booleans(),
header=hypothesis.strategies.booleans(),
)
@mark_hypothesis
def test_b2a_qp_a2b_qp_round_trip(self, binary, quotetabs, istext, header):
converted = binascii.b2a_qp(
self.type2test(binary),
Expand Down Expand Up @@ -504,6 +507,7 @@ def test_b2a_base64_newline(self):
binary=hypothesis.strategies.binary(),
newline=hypothesis.strategies.booleans(),
)
@mark_hypothesis
def test_base64_roundtrip(self, binary, newline):
converted = binascii.b2a_base64(self.type2test(binary), newline=newline)
restored = binascii.a2b_base64(self.type2test(converted))
Expand Down
4 changes: 3 additions & 1 deletion Lib/test/test_math_property.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import functools
import unittest
from math import isnan, nextafter
from test.support import requires_IEEE_754
from test.support import requires_IEEE_754, mark_module
from test.support.hypothesis_helper import hypothesis

mark_module('hypothesis')

floats = hypothesis.strategies.floats
integers = hypothesis.strategies.integers

Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_tools/test_makeunicodedata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from test.test_tools import skip_if_missing, imports_under_tool
from test import support
from test.support.hypothesis_helper import hypothesis
from test.support.hypothesis_helper import hypothesis, mark_hypothesis

st = hypothesis.strategies
given = hypothesis.given
Expand Down Expand Up @@ -115,6 +115,7 @@ def test_forbid_empty_dawg(self):
("ab", "1"),
]
)
@mark_hypothesis
def test_dawg(self, data):
# suppress debug prints
with support.captured_stdout() as output:
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_zoneinfo/test_zoneinfo_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import unittest
import zoneinfo

from test.support import mark_module
from test.support.hypothesis_helper import hypothesis

import test.test_zoneinfo._support as test_support

mark_module('hypothesis')

ZoneInfoTestBase = test_support.ZoneInfoTestBase

py_zoneinfo, c_zoneinfo = test_support.get_modules()
Expand Down
Loading