Skip to content

Commit

Permalink
v2.0.13 replace re.match with re.search in declarative.function.stdou…
Browse files Browse the repository at this point in the history
…tRegex
  • Loading branch information
Jelleas committed Oct 17, 2024
1 parent 2122db5 commit db699c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion checkpy/lib/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def stdoutRegex(self, regex: Union[str, re.Pattern], readable: Optional[str]=Non
"""
Assert that the last call printed output matching regex.
If readable is passed, show that instead of the regex in the test's output.
Uses built-in re.search underneath the hood to find the first match.
"""
def testStdoutRegex(state: FunctionState):
nonlocal regex
Expand All @@ -176,7 +177,7 @@ def testStdoutRegex(state: FunctionState):

actual = state.function.printOutput

match = regex.match(actual)
match = regex.search(actual)
if not match:
if readable:
raise AssertionError(f"The printed output does not match the expected output. This is expected:\n"
Expand Down
2 changes: 1 addition & 1 deletion checkpy/lib/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def getSource(fileName: _Optional[_Union[str, _Path]]=None) -> str:
if fileName is None:
if _checkpy.file is None:
raise _exception.CheckpyError(
message=f"Cannot call getSource() without passing fileName as argument if not test is running."
message=f"Cannot call getSource() without passing fileName as argument if no test is running."
)
fileName = _checkpy.file.name

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
setup(
name='checkPy',

version='2.0.12',
version='2.0.13',

description='A simple python testing framework for educational purposes',
long_description=long_description,
Expand Down

0 comments on commit db699c5

Please sign in to comment.