File tree Expand file tree Collapse file tree 3 files changed +56
-8
lines changed
Expand file tree Collapse file tree 3 files changed +56
-8
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ tex2pdf*
1111.coverage
1212.idea
1313.vscode
14- 04_jump_the_five /jump.py
151405_howler /howler.py
161506_wc /wc.py
171607_gashlycrumb /gashlycrumb.py
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ """
3+ Author : Jeffrey Paz-Schmid
4+ Date : 2023-01-22
5+ Purpose: Encode Phone-Numbers
6+ """
7+
8+ import argparse
9+
10+
11+ # --------------------------------------------------
12+ def get_args ():
13+ """Get command-line arguments"""
14+
15+ parser = argparse .ArgumentParser (
16+ description = "Jump the Five" ,
17+ formatter_class = argparse .ArgumentDefaultsHelpFormatter ,
18+ )
19+
20+ parser .add_argument ("text" , metavar = "str" , help = "Input text" )
21+
22+ return parser .parse_args ()
23+
24+
25+ # --------------------------------------------------
26+ def main ():
27+ """Make a jazz noise here"""
28+
29+ args = get_args ()
30+
31+ jumper = {
32+ "1" : "9" ,
33+ "2" : "8" ,
34+ "3" : "7" ,
35+ "4" : "6" ,
36+ "5" : "0" ,
37+ "6" : "4" ,
38+ "7" : "3" ,
39+ "8" : "2" ,
40+ "9" : "1" ,
41+ "0" : "5" ,
42+ }
43+
44+ print ("" .join ([jumper .get (char , char ) for char in args .text ]))
45+
46+
47+ # --------------------------------------------------
48+ if __name__ == "__main__" :
49+ main ()
Original file line number Diff line number Diff line change 44import os
55from subprocess import getstatusoutput
66
7- prg = './ jump.py'
7+ prg = " jump.py"
88
99
1010# --------------------------------------------------
@@ -18,19 +18,19 @@ def test_exists():
1818def test_usage ():
1919 """usage"""
2020
21- for flag in ['-h' , ' --help' ]:
22- rv , out = getstatusoutput (f' { prg } { flag } ' )
21+ for flag in ["-h" , " --help" ]:
22+ rv , out = getstatusoutput (f" { prg } { flag } " )
2323 assert rv == 0
24- assert out .lower ().startswith (' usage' )
24+ assert out .lower ().startswith (" usage" )
2525
2626
2727# --------------------------------------------------
2828def test_01 ():
2929 """test"""
3030
31- rv , out = getstatusoutput (f' { prg } 123-456-7890' )
31+ rv , out = getstatusoutput (f" { prg } 123-456-7890" )
3232 assert rv == 0
33- assert out == ' 987-604-3215'
33+ assert out == " 987-604-3215"
3434
3535
3636# --------------------------------------------------
@@ -39,4 +39,4 @@ def test_02():
3939
4040 rv , out = getstatusoutput (f'{ prg } "That number to call is 098-765-4321."' )
4141 assert rv == 0
42- assert out .rstrip () == ' That number to call is 512-340-6789.'
42+ assert out .rstrip () == " That number to call is 512-340-6789."
You can’t perform that action at this time.
0 commit comments