-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
42 lines (28 loc) · 925 Bytes
/
test.py
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
#!/usr/bin/env python3
"""tests for jump.py"""
import os
from subprocess import getstatusoutput
prg = './jump.py'
# --------------------------------------------------
def test_exists():
"""exists"""
assert os.path.isfile(prg)
# --------------------------------------------------
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_01():
"""test"""
rv, out = getstatusoutput(f'{prg} 123-456-7890')
assert rv == 0
assert out == '987-604-3215'
# --------------------------------------------------
def test_02():
"""test"""
rv, out = getstatusoutput(f'{prg} "That number to call is 098-765-4321."')
assert rv == 0
assert out.rstrip() == 'That number to call is 512-340-6789.'