예제 #1
0
 def test_get_first_arg(self):
     cli = Cli()
     cli.user_arguments = ["script_name", "arg1"]
     assert cli.get_first_arg() == "arg1"
     cli.user_arguments = ["smth", "arg1", "arg2", "arg3"]
     assert cli.get_first_arg() == "arg1", "[arg1] should be returned"
     cli.user_arguments = ["bla"]
     try:
         cli.get_first_arg()
         self.fail("Exception should be thrown")
     except NameError as e:
         assert str(e) == "ERROR: You have to specify at least alg id!"
     cli.user_arguments = []
     try:
         cli.get_first_arg()
         self.fail("Exception should be thrown")
     except NameError as e:
         assert str(e) == "ERROR: You have to specify at least alg id!"
예제 #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()