コード例 #1
0
ファイル: test_parsing_hunt.py プロジェクト: obilaniu/orion
def test_hunt_command_full_parsing(database, monkeypatch):
    """Test the parsing of the `hunt` command"""
    monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
    parser, subparsers = _create_parser()
    args_list = [
        "hunt",
        "-n",
        "test",
        "--config",
        "./orion_config_random.yaml",
        "--max-trials",
        "400",
        "--pool-size",
        "4",
        "--worker-trials",
        "5",
        "./black_box.py",
        "-x~normal(1,1)",
    ]

    hunt.add_subparser(subparsers)
    subparsers.choices["hunt"].set_defaults(func="")

    args = vars(parser.parse_args(args_list))
    assert args["name"] == "test"
    assert args["config"].name == "./orion_config_random.yaml"
    assert args["user_args"] == ["./black_box.py", "-x~normal(1,1)"]
    assert args["pool_size"] == 4
    assert args["max_trials"] == 400
    assert args["worker_trials"] == 5
コード例 #2
0
def test_hunt_command_full_parsing(database, monkeypatch):
    """Test the parsing of the `hunt` command"""
    monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
    parser, subparsers = _create_parser()
    args_list = [
        "hunt", "-n", "test", "--config", "./orion_config_random.yaml",
        "--max-trials", "400", "--pool-size", "4", "./black_box.py",
        "-x~normal(1,1)"
    ]

    hunt.add_subparser(subparsers)
    subparsers.choices['hunt'].set_defaults(func='')

    args = vars(parser.parse_args(args_list))
    assert args['name'] == 'test'
    assert args['config'].name == './orion_config_random.yaml'
    assert args['user_args'] == ['./black_box.py', '-x~normal(1,1)']
    assert args['pool_size'] == 4
    assert args['max_trials'] == 400