Exemplo n.º 1
0
def test_permutation_vector():
    pv = ann.PermutationVector((0, 2, 3, 1))
    assert pv[0] == 0
    assert pv[2] == 3

    pv2 = ann.PermutationVector((0, 2, 3, 1))
    assert pv == pv2

    pv4 = ann.PermutationVector((0, 3, 1, 2))
    assert pv.IsInverse(pv4)
Exemplo n.º 2
0
def test_permutation_vector():
    pv = ann.PermutationVector((0, 2, 3, 1))
    assert pv[0] == 0
    assert pv[2] == 3

    pv2 = ann.PermutationVector((0, 2, 3, 1))
    assert pv == pv2

    pv4 = ann.PermutationVector((0, 3, 1, 2))
    assert pv.IsInverse(pv4)

    with pytest.raises(ValueError) as err:
        pv4[4]

    assert err.type is ValueError
Exemplo n.º 3
0
def test_permute_descriptor_default_values():
    pv = ann.PermutationVector((0, 2, 3, 1))
    desc = ann.PermuteDescriptor(pv)
    assert desc.m_DimMappings.GetSize() == 4
    assert desc.m_DimMappings[0] == 0
    assert desc.m_DimMappings[1] == 2
    assert desc.m_DimMappings[2] == 3
    assert desc.m_DimMappings[3] == 1
Exemplo n.º 4
0
def test_transpose_descriptor_default_values():
    pv = ann.PermutationVector((0, 3, 2, 1, 4))
    desc = ann.TransposeDescriptor(pv)
    assert desc.m_DimMappings.GetSize() == 5
    assert desc.m_DimMappings[0] == 0
    assert desc.m_DimMappings[1] == 3
    assert desc.m_DimMappings[2] == 2
    assert desc.m_DimMappings[3] == 1
    assert desc.m_DimMappings[4] == 4