55import re
66from subprocess import getstatusoutput , getoutput
77
8- prg = ' ./scrambler.py'
9- fox = ' ../inputs/fox.txt'
10- bustle = ' ../inputs/the-bustle.txt'
11- spiders = ' ../inputs/spiders.txt'
8+ PRG = " ./scrambler.py"
9+ FOX = " ../inputs/fox.txt"
10+ BUSTLE = " ../inputs/the-bustle.txt"
11+ SPIDERS = " ../inputs/spiders.txt"
1212
1313
1414# --------------------------------------------------
1515def test_exists ():
1616 """exists"""
1717
18- assert os .path .isfile (prg )
18+ assert os .path .isfile (PRG )
1919
2020
2121# --------------------------------------------------
2222def test_usage ():
2323 """usage"""
2424
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 } " )
2727 assert rv == 0
2828 assert re .match ("usage" , out , re .IGNORECASE )
2929
@@ -32,17 +32,17 @@ def test_usage():
3232def test_text1 ():
3333 """Text"""
3434
35- out = getoutput (f' { prg } foobar -s 1' )
36- assert out .strip () == ' faobor'
35+ out = getoutput (f"python { PRG } foobar -s 1" )
36+ assert out .strip () == " faobor"
3737
3838
3939# --------------------------------------------------
4040def test_text2 ():
4141 """Text"""
4242
43- text = ' The quick brown fox jumps over the lazy dog.'
44- expected = ' The qicuk bworn fox jpmus over the lzay dog.'
45- out = getoutput (f'{ prg } "{ text } " -s 2' )
43+ text = " The quick brown fox jumps over the lazy dog."
44+ expected = " The qicuk bworn fox jpmus over the lzay dog."
45+ out = getoutput (f'python { PRG } "{ text } " -s 2' )
4646 assert out .strip () == expected
4747
4848
@@ -62,22 +62,22 @@ def test_file_bustle():
6262Unitl eettnriy.
6363 """ .strip ()
6464
65- out = getoutput (f' { prg } --seed 3 { bustle } ' )
65+ out = getoutput (f"python { PRG } --seed 3 { BUSTLE } " )
6666 assert out .strip () == expected .strip ()
6767
6868
6969# --------------------------------------------------
7070def test_file_fox ():
7171 """File input"""
7272
73- out = getoutput (f' { prg } --seed 4 { fox } ' )
74- assert out .strip () == ' The qciuk bworn fox jpums oevr the lzay dog.'
73+ out = getoutput (f"python { PRG } --seed 4 { FOX } " )
74+ assert out .strip () == " The qciuk bworn fox jpums oevr the lzay dog."
7575
7676
7777# --------------------------------------------------
7878def test_file_spiders ():
7979 """File input"""
8080
81- out = getoutput (f' { prg } --seed 9 { spiders } ' )
81+ out = getoutput (f"python { PRG } --seed 9 { SPIDERS } " )
8282 expected = "Do'nt wrory, sedrpis,\n I keep hsoue\n calusaly."
8383 assert out .strip () == expected
0 commit comments