Example #1
0
def test_one_reserved_kwarg_raises():
    with pytest.raises(htmap.exceptions.ReservedOptionKeyword) as exc_info:
        htmap.MapOptions(
            transfer_input_files = 'foobar',
        )

    assert 'keyword' in exception_msg(exc_info)
Example #2
0
def test_two_reserved_kwarg_raises():
    with pytest.raises(htmap.exceptions.ReservedOptionKeyword) as exc_info:
        htmap.MapOptions(
            transfer_input_files="foobar",
            jobbatchname="pink",
        )

    assert "keywords" in exception_msg(exc_info)
Example #3
0
def test_generic_itemdata_too_few(tmp_path):
    tag = "foo"
    num_components = 1
    map_options = htmap.MapOptions(stooge=["larry", "moe"], )

    with pytest.raises(htmap.exceptions.MisalignedInputData) as exc_info:
        create_submit_object_and_itemdata(
            tag,
            tmp_path,
            num_components,
            map_options,
        )

    assert "stooge" in exception_msg(exc_info)
Example #4
0
def test_fewer_input_files_than_components(tmp_path):
    tag = "foo"
    num_components = 5
    map_options = htmap.MapOptions(input_files=[["foo.txt"]], )

    with pytest.raises(htmap.exceptions.MisalignedInputData) as exc_info:
        create_submit_object_and_itemdata(
            tag,
            tmp_path,
            num_components,
            map_options,
        )

    assert "input_files" in exception_msg(exc_info)
Example #5
0
def test_fewer_components_than_input_files(tmp_path):
    tag = 'foo'
    num_components = 1
    map_options = htmap.MapOptions(input_files=[['foo.txt'], ['bar.txt'],
                                                ['buz.txt']], )

    with pytest.raises(htmap.exceptions.MisalignedInputData) as exc_info:
        create_submit_object_and_itemdata(
            tag,
            tmp_path,
            num_components,
            map_options,
        )

    assert 'input_files' in exception_msg(exc_info)
Example #6
0
def test_generic_itemdata_too_few():
    tag = 'foo'
    map_dir = Path().cwd()
    num_components = 1
    map_options = htmap.MapOptions(
        stooge = ['larry', 'moe'],
    )

    with pytest.raises(htmap.exceptions.MisalignedInputData) as exc_info:
        create_submit_object_and_itemdata(
            tag,
            map_dir,
            num_components,
            map_options,
        )

    assert 'stooge' in exception_msg(exc_info)
Example #7
0
def test_fewer_input_files_than_components():
    tag = 'foo'
    map_dir = Path().cwd()
    num_components = 5
    map_options = htmap.MapOptions(
        input_files = [['foo.txt']],
    )

    with pytest.raises(htmap.exceptions.MisalignedInputData) as exc_info:
        create_submit_object_and_itemdata(
            tag,
            map_dir,
            num_components,
            map_options,
        )

    assert 'input_files' in exception_msg(exc_info)