Skip to content

Commit db699c5

Browse files
committed
v2.0.13 replace re.match with re.search in declarative.function.stdoutRegex
1 parent 2122db5 commit db699c5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

checkpy/lib/declarative.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def stdoutRegex(self, regex: Union[str, re.Pattern], readable: Optional[str]=Non
163163
"""
164164
Assert that the last call printed output matching regex.
165165
If readable is passed, show that instead of the regex in the test's output.
166+
Uses built-in re.search underneath the hood to find the first match.
166167
"""
167168
def testStdoutRegex(state: FunctionState):
168169
nonlocal regex
@@ -176,7 +177,7 @@ def testStdoutRegex(state: FunctionState):
176177

177178
actual = state.function.printOutput
178179

179-
match = regex.match(actual)
180+
match = regex.search(actual)
180181
if not match:
181182
if readable:
182183
raise AssertionError(f"The printed output does not match the expected output. This is expected:\n"

checkpy/lib/static.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def getSource(fileName: _Optional[_Union[str, _Path]]=None) -> str:
2929
if fileName is None:
3030
if _checkpy.file is None:
3131
raise _exception.CheckpyError(
32-
message=f"Cannot call getSource() without passing fileName as argument if not test is running."
32+
message=f"Cannot call getSource() without passing fileName as argument if no test is running."
3333
)
3434
fileName = _checkpy.file.name
3535

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
setup(
1212
name='checkPy',
1313

14-
version='2.0.12',
14+
version='2.0.13',
1515

1616
description='A simple python testing framework for educational purposes',
1717
long_description=long_description,

0 commit comments

Comments
 (0)