forked from tddbc/python_pytest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_snake.py
More file actions
41 lines (31 loc) · 909 Bytes
/
test_snake.py
File metadata and controls
41 lines (31 loc) · 909 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
サンプルテスト
"""
import pytest
from acme.snake import Python, MontyPython
def test_python_hisses():
sut = Python()
actual = sut.say()
assert 'Hello' not in actual, 'PythonはHelloと言わない'
@pytest.fixture
def monty_python():
return MontyPython()
class TestMontyPython:
def test_say_name_guido(self, monty_python):
actual = monty_python.say('Guido')
assert actual == 'Hello Guido'
def test_say_name_kent(self, monty_python):
actual = monty_python.say('Kent')
assert actual == 'Hello Kent'
@pytest.mark.parametrize(
"name, expected",
[
('Terry', 'Hello Terry'),
('John', 'Hello John'),
]
)
def test_say_name(self, monty_python, name, expected):
actual = monty_python.say(name)
assert actual == expected