Skip to content

Commit 23e8a8a

Browse files
committed
Test test method
1 parent 7c610cf commit 23e8a8a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/test_lib.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,28 @@ def test(entry):
4040
assert getattr(pattern, key) == entry["expected_obj"][key]
4141

4242
if entry.get("expected_match") == "error":
43+
with pytest.raises(Exception):
44+
pattern.test(*entry["inputs"])
45+
4346
with pytest.raises(Exception):
4447
pattern.exec(*entry["inputs"])
48+
4549
return
4650

47-
if isinstance(entry.get("expected_match"), dict):
48-
result = pattern.exec(*entry["inputs"])
51+
elif isinstance(entry.get("expected_match"), dict):
52+
assert pattern.test(*entry["inputs"])
4953

54+
result = pattern.exec(*entry["inputs"])
5055
for key in entry["expected_match"]:
5156
assert result[key] == entry["expected_match"][key]
5257

5358
else:
54-
result = pattern.exec(*entry["inputs"])
55-
assert result is None
59+
assert not pattern.test(*entry["inputs"])
60+
61+
assert pattern.exec(*entry["inputs"]) is None
5662

5763
if "exactly_empty_components" in entry:
5864
result = pattern.exec(*entry["inputs"])
59-
6065
for component in entry["exactly_empty_components"]:
6166
if result:
6267
assert result[component]["groups"] == {}

0 commit comments

Comments
 (0)