-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: enable exact_match config in playwright notebook test (#2027)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6846643
commit 20bc7d4
Showing
2 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from tests.common.run_notebook import assert_match_output | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"expected, actual, exact", | ||
[ | ||
("success: 6", "success: 6", True), | ||
("success", "success: 6", False), | ||
("6", "6", True), | ||
("cde", "abcde", False), | ||
("12.*5", "12345", True), | ||
(".*5", "12345", True), | ||
("ab.*ef", "123abcdef123", False), | ||
], | ||
) | ||
def test_output_match(expected, actual, exact): | ||
assert_match_output(expected, actual, exact_match=exact) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"expected, actual, exact", | ||
[ | ||
("True", "False", True), | ||
("success: 6", "success", True), | ||
("60", "6", True), | ||
("abcde", "cde", True), | ||
("ab.*ef", "123abcdef123", True), | ||
], | ||
) | ||
def test_output_not_match(expected, actual, exact): | ||
msg = f"Expected output: {expected} not found in actual output: {actual}" | ||
with pytest.raises(AssertionError, match=msg): | ||
assert_match_output(expected, actual, exact_match=exact) |