Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
51 lines (34 loc) · 1.17 KB

File metadata and controls

executable file
·
51 lines (34 loc) · 1.17 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
46
47
48
49
50
51
#!/usr/bin/env python3
"""tests for hello.py"""
import os
from subprocess import getstatusoutput, getoutput
prg = './hello.py'
# --------------------------------------------------
def test_exists():
"""exists"""
assert os.path.isfile(prg)
# --------------------------------------------------
def test_runnable():
"""Runs using python3"""
out = getoutput(f'python3 {prg}')
assert out.strip() == 'Hello, World!'
# --------------------------------------------------
def test_executable():
"""Says 'Hello, World!' by default"""
out = getoutput(prg)
assert out.strip() == 'Hello, World!'
# --------------------------------------------------
def test_usage():
"""usage"""
for flag in ['-h', '--help']:
rv, out = getstatusoutput(f'{prg} {flag}')
assert rv == 0
assert out.lower().startswith('usage')
# --------------------------------------------------
def test_input():
"""test for input"""
for val in ['Universe', 'Multiverse']:
for option in ['-n', '--name']:
rv, out = getstatusoutput(f'{prg} {option} {val}')
assert rv == 0
assert out.strip() == f'Hello, {val}!'
Morty Proxy This is a proxified and sanitized view of the page, visit original site.