5
5
import re
6
6
from subprocess import getstatusoutput , getoutput
7
7
8
- prg = ' ./gematria.py'
9
- spiders = ' ../inputs/spiders.txt'
10
- fox = ' ../inputs/fox.txt'
11
- sonnet = ' ../inputs/sonnet-29.txt'
8
+ PRG = " ./gematria.py"
9
+ SPIDERS = " ../inputs/spiders.txt"
10
+ FOX = " ../inputs/fox.txt"
11
+ SONNET = " ../inputs/sonnet-29.txt"
12
12
13
13
14
14
# --------------------------------------------------
15
15
def test_exists ():
16
16
"""exists"""
17
17
18
- assert os .path .isfile (prg )
18
+ assert os .path .isfile (PRG )
19
19
20
20
21
21
# --------------------------------------------------
22
22
def test_usage ():
23
23
"""usage"""
24
24
25
- for flag in ['-h' , ' --help' ]:
26
- rv , out = getstatusoutput (f' { prg } { flag } ' )
25
+ for flag in ["-h" , " --help" ]:
26
+ rv , out = getstatusoutput (f"python { PRG } { flag } " )
27
27
assert rv == 0
28
28
assert re .match ("usage" , out , re .IGNORECASE )
29
29
@@ -32,31 +32,31 @@ def test_usage():
32
32
def test_text ():
33
33
"""Text"""
34
34
35
- out = getoutput (f'{ prg } "foo bar baz"' )
36
- assert out .strip () == ' 324 309 317'
35
+ out = getoutput (f'python { PRG } "foo bar baz"' )
36
+ assert out .strip () == " 324 309 317"
37
37
38
38
39
39
# --------------------------------------------------
40
40
def test_fox ():
41
41
"""File"""
42
42
43
- out = getoutput (f' { prg } { fox } ' )
44
- assert out .strip () == ' 289 541 552 333 559 444 321 448 314'
43
+ out = getoutput (f"python { PRG } { FOX } " )
44
+ assert out .strip () == " 289 541 552 333 559 444 321 448 314"
45
45
46
46
47
47
# --------------------------------------------------
48
48
def test_spiders ():
49
49
"""File"""
50
50
51
- out = getoutput (f' { prg } { spiders } ' )
52
- assert out .strip () == ' 405 579 762\n 73 421 548\n 862'
51
+ out = getoutput (f"python { PRG } { SPIDERS } " )
52
+ assert out .strip () == " 405 579 762\n 73 421 548\n 862"
53
53
54
54
55
55
# --------------------------------------------------
56
56
def test_sonnet ():
57
57
"""File"""
58
58
59
- out = getoutput (f' { prg } { sonnet } ' )
59
+ out = getoutput (f"python { PRG } { SONNET } " )
60
60
expected = """
61
61
631 107
62
62
719 1132
0 commit comments