def main(): args = parser_arg() args.sub_command_name if args.sub_command_name == "init": init_command(args) elif args.sub_command_name == "add": add_command(args) elif args.sub_command_name == "generate" or args.sub_command_name == "g": generate_command(args)
def test_generate_command_for_place_commands(line, expected_x, expected_y, expected_f): command = generate_command(line) assert type(command) == PlaceCommand assert command.directive == "PLACE" assert command.x_init == expected_x assert command.y_init == expected_y assert command.f_init == expected_f
def test_generate_command_for_standard_commands(line): command = generate_command(line) assert type(command) == Command assert command.directive == line
def test_generator_command_reached_EOF(): assert generate_command("") is None
def test_generate_command_for_bad_commands(bad_line): with pytest.raises(InvalidCommand): generate_command(bad_line)