示例#1
0
def test_config_plugin():
    args, config_args, _ = _parsebase(['--device=gpu', '--device-memory=20%'])
    assert (args == {})
    assert (config_args == {'device': 'gpu', 'device.memory': '20%'})
    with pytest.raises(getopt.GetoptError):
        _parsebase(['--device-id=gpu', '--device-memory=20%'])
示例#2
0
def test_invalid_opt():
    with pytest.raises(getopt.GetoptError):
        _parsebase(['--invalid', 'opt'])
    with pytest.raises(getopt.GetoptError):
        _parsebase(['--test=10%'])
示例#3
0
def test_parse_short_args():
    args, _, rest = _parsebase(
        ['-m', 'inception-v3', '--random-seed=42', 'train'])
    assert args == {'model': 'inception-v3', 'random-seed': '42'}
    assert rest == ['train']
示例#4
0
def test_invalid_input():
    with pytest.raises(getopt.GetoptError):
        _parsebase(['-m', '--random-seed', '42'])
示例#5
0
def test_parse_base_version():
    args, _, _ = _parsebase(['-v'])
    assert 'version' in args

    args, _, _ = _parsebase(['--version'])
    assert 'version' in args