Ejemplo n.º 1
0
 def test_correctArgsShort(self) -> None:
     argsList = ['L', 'p', 'i.txt', 'o.json']
     sys.argv[1:] = setUp(argsList)
     args = ArgParse.ArgParse()
     self.assertName(argsList[0], args.userName)
     self.assertName(argsList[1], args.printerName)
     self.assertPath(argsList[2], args.inputFile)
     self.assertPath(argsList[3], args.outputFile)
Ejemplo n.º 2
0
 def test_correctArgs(self) -> None:
     argsList = ['UserName123', 'printer1@asdf', 'input.txt', 'out.json']
     sys.argv[1:] = setUp(argsList)
     args = ArgParse.ArgParse()
     self.assertName(argsList[0], args.userName)
     self.assertName(argsList[1], args.printerName)
     self.assertPath(argsList[2], args.inputFile)
     self.assertPath(argsList[3], args.outputFile)
Ejemplo n.º 3
0
 def test_emptyOutFile(self) -> None:
     argsList = ['Lukas', 'printer1', 'input.txt', '']
     sys.argv[1:] = setUp(argsList)
     try:
         ArgParse.ArgParse()
     except ValueError:
         self.assertTrue(True)
     else:
         self.assertTrue(False)
Ejemplo n.º 4
0
 def test_wrongOutFormat(self) -> None:
     argsList = ['UserName123', 'printer1@asdf', 'input.txt', 'out.jsn']
     sys.argv[1:] = setUp(argsList)
     try:
         ArgParse.ArgParse()
     except TypeError:
         self.assertTrue(True)
     else:
         self.assertTrue(False)
Ejemplo n.º 5
0
def main() -> None:
    try:
        args = ArgParse.ArgParse()
        args.parseArgs()
        IOHandle.IOHandle(args)
    except ValueError:
        print('No script parameter can be empty!', file=stderr)
    except TypeError:
        print('The output file must be the JSON format (.json)', file=stderr)
    except FileNotFoundError:
        print('The input file could not be found!', file=stderr)
    except Exception:
        print('An unexpected error has occured!', file=stderr)
Ejemplo n.º 6
0
def parse_cli(config_list):
	args = ap.ArgParse(lst=config_list)
	fetch = args.parse()