Repository navigation
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·67 lines (47 loc) · 1.58 KB
/
Copy pathtest.py
File metadata and controls
executable file
·67 lines (47 loc) · 1.58 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
"""tests for article.py"""
import os
import random
import re
import string
from subprocess import getstatusoutput
prg = './article.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_masculine_lower():
"""masculine_lower"""
word = random.choice('chico teatro cartero'.split())
rv, out = getstatusoutput(f'{prg} {word}')
assert rv == 0
assert out == f'Me gusto el {word}.'
# --------------------------------------------------
def test_masculine_upper():
"""masculine_upper"""
word = random.choice('CHICO TEATRO CARTERO'.split())
rv, out = getstatusoutput(f'{prg} {word}')
assert rv == 0
assert out == f'Me gusto el {word}.'
# --------------------------------------------------
def test_feminine_lower():
"""feminine_lower"""
word = random.choice('chica gata abuela'.split())
rv, out = getstatusoutput(f'{prg} {word}')
assert rv == 0
assert out == f'Me gusto la {word}.'
# --------------------------------------------------
def test_feminine_upper():
"""feminine_upper"""
word = random.choice('CHICA GATA ABUELA'.split())
rv, out = getstatusoutput(f'{prg} {word}')
assert rv == 0
assert out == f'Me gusto la {word}.'