def test_datacontainer_wrong_args4():
    """The test checks, if an error is thrown, when totally wrong
    attributes are passed.
    """
    with pytest.raises(TypeError):
        bidirectCaster.copy_data(3)

    with pytest.raises(TypeError):
        bidirectCaster.copy_data(3, "test")
def test_datacontainer_wrong_args3():
    """The test checks, if an error is thrown, the attributes date
    and scale are missing.
    """

    class wrong_datacontainer3:
        def __init__(self):
            pass

    wdc3 = wrong_datacontainer3()

    with pytest.raises(Exception):
        bidirectCaster.copy_data(wdc3)
def test_datacontainer_wrong_args2():
    """The test checks, if an error is thrown, the attribute data
    is missing.
    """

    class wrong_datacontainer2:
        def __init__(self, scalar: float):
            self.scalar = scalar

    wdc2 = wrong_datacontainer2(1.4)

    with pytest.raises(AttributeError):
        bidirectCaster.copy_data(wdc2)
def test_datacontainer_wrong_args1():
    """The test checks, if an error is thrown, the attribute scale
    is missing.
    """

    class wrong_datacontainer1:
        def __init__(self, data: List[float]):
            self.data = data

    wdc1 = wrong_datacontainer1([42.0, 12.0])

    with pytest.raises(AttributeError):
        bidirectCaster.copy_data(wdc1)
def test_datacontainer_wrong_args5():
    """The test checks, if an error is thrown, if the attributes
    data and scale have the wrong type.
    """
    dc1 = bidirect.data_container(data=["d", "e"], scalar=1.5)

    with pytest.raises(RuntimeError):
        bidirectCaster.copy_data(dc1)

    dc2 = bidirect.data_container(data=[1.6, 2.2], scalar="foo")

    with pytest.raises(RuntimeError):
        bidirectCaster.copy_data(dc2)
def test_copy_container():
    """Copy a datacontainer."""
    input = bidirect.data_container(data=[1.0, 2.0, 3.0, 4.0], scalar=3.0)
    expected_result = bidirect.data_container(data=[1.0, 2.0, 3.0, 4.0], scalar=3.0)
    result = bidirectCaster.copy_data(input)

    # change input after copy_data, to verify, that the result is a copy and no reference
    input.data[2] = -10.0
    input.scalar = -1.0

    assert result.data == expected_result.data
    assert result.scalar == expected_result.scalar