forked from datacamp/pythonwhat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_has_output.py
More file actions
45 lines (39 loc) · 1.08 KB
/
Copy pathtest_has_output.py
File metadata and controls
45 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import pytest
import tests.helper as helper
from pythonwhat.test_exercise import setup_state
@pytest.mark.parametrize(
"stu, passes",
[
('print("Hi, there!")', True),
('print("hi there!")', True),
('print("Hello there")', False),
],
)
def test_has_output_basic(stu, passes):
s = setup_state(stu, "")
with helper.verify_sct(passes):
s.has_output(r"[H|h]i,*\s+there!")
@pytest.mark.parametrize(
"stu, passes",
[
('print("Hi, there!")', True),
('print("hi there!")', False),
('print("Hello there")', False),
],
)
def test_has_output_pattern(stu, passes):
s = setup_state(stu, "")
with helper.verify_sct(passes):
s.has_output("Hi, there!", pattern=False)
@pytest.mark.parametrize(
"stu, passes",
[
('print("Hi, there!")', True),
('print("hi there!")', True),
('print("Hello there")', False),
],
)
def test_test_output_contains(stu, passes):
s = setup_state(stu, "")
with helper.verify_sct(passes):
s.test_output_contains(r"[H|h]i,*\s+there!")