示例#1
0
 def test_get_rest_arguments(self):
     cli = Cli()
     cli.user_arguments = ["script_name", "arg1"]
     assert cli.get_rest_arguments() == [], "empty list should be returned (two parameters)"
     cli.user_arguments = ["smth", "arg1", "arg2", "arg3"]
     assert cli.get_rest_arguments() == ["arg2", "arg3"], "[arg2, arg3] should be returned"
     cli.user_arguments = ["bla"],
     assert cli.get_rest_arguments() == [], "empty list should be returned (one parameter)"
     cli.user_arguments = [],
     assert cli.get_rest_arguments() == [], "empty list should be returned (no parameters)"
     cli.user_arguments = ["smth", "arg1", "arg2"]
     assert cli.get_rest_arguments() == ["arg2"], "[arg2] should be returned"
示例#2
0
from cli import Cli
from algorithms import AlgorithmManager

if __name__ == '__main__':
    cli = Cli()
    requested_alg = cli.get_first_arg()
    alg_args = cli.get_rest_arguments()
    alg = AlgorithmManager(requested_alg, alg_args)
    alg.run()