Skip to content

Commit 8ca6c34

Browse files
committed
Move helper fn to compat.py
1 parent c0a60d7 commit 8ca6c34

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

hypothesis-python/src/hypothesis/core.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from hypothesis.internal.compat import (
7171
PYPY,
7272
BaseExceptionGroup,
73+
add_note,
7374
bad_django_TestCase,
7475
get_type_hints,
7576
int_from_bytes,
@@ -1008,15 +1009,6 @@ def run_engine(self):
10081009
_raise_to_user(errors_to_report, self.settings, report_lines)
10091010

10101011

1011-
def add_note(exc, note):
1012-
try:
1013-
exc.add_note(note)
1014-
except AttributeError:
1015-
if not hasattr(exc, "__notes__"):
1016-
exc.__notes__ = []
1017-
exc.__notes__.append(note)
1018-
1019-
10201012
def _raise_to_user(errors_to_report, settings, target_lines, trailer=""):
10211013
"""Helper function for attaching notes and grouping multiple errors."""
10221014
failing_prefix = "Falsifying example: "

hypothesis-python/src/hypothesis/internal/compat.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
WINDOWS = platform.system() == "Windows"
4444

4545

46+
def add_note(exc, note):
47+
try:
48+
exc.add_note(note)
49+
except AttributeError:
50+
if not hasattr(exc, "__notes__"):
51+
exc.__notes__ = []
52+
exc.__notes__.append(note)
53+
54+
4655
def escape_unicode_characters(s: str) -> str:
4756
return codecs.encode(s, "unicode_escape").decode("ascii")
4857

0 commit comments

Comments
 (0)