Skip to content

Commit 53388f6

Browse files
committed
hello.py: Add unit test
1 parent fe8ccbc commit 53388f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Test

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
basedir=$(cd "$(dirname "$0")" && pwd -P)
44

55
cd "$basedir"
6-
python hello.py
6+
pytest hello.py

hello.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
print("Hello, world.")
1+
def hello(name):
2+
return 'Hello, {}.'.format(name)
3+
4+
def test_hello():
5+
assert 'Hello, Fred.' == hello('Fred')
6+
7+
if __name__ == '__main__':
8+
print(hello('Taro'))

0 commit comments

Comments
 (0)