Beispiel #1
0
def test_equal():
    basis1 = Basis.from_euler(Vector3(1, 2, 3))
    basis2 = Basis.from_euler(Vector3(1, 2, 3))
    assert basis1 == basis2
    basis2.x = Vector3(1, 2, 3)
    assert basis1 != basis2
    basis1.x = Vector3(1, 2, 3)
    assert basis1 == basis2
    bad = Basis.from_euler(Vector3(1, 2, 4))
    assert not basis1 == bad  # Force use of __eq__
Beispiel #2
0
def test_bad_equal(arg):
    basis = Basis.from_euler(Vector3(1, 2, 3))
    assert basis != arg
Beispiel #3
0

def test_equal():
    basis1 = Basis.from_euler(Vector3(1, 2, 3))
    basis2 = Basis.from_euler(Vector3(1, 2, 3))
    assert basis1 == basis2
    basis2.x = Vector3(1, 2, 3)
    assert basis1 != basis2
    basis1.x = Vector3(1, 2, 3)
    assert basis1 == basis2
    bad = Basis.from_euler(Vector3(1, 2, 4))
    assert not basis1 == bad  # Force use of __eq__


@pytest.mark.parametrize(
    "arg", [None, 0, "foo", Basis.from_euler(Vector3(1, 2, 4))])
def test_bad_equal(arg):
    basis = Basis.from_euler(Vector3(1, 2, 3))
    assert basis != arg


def test_repr():
    v = Basis(Vector3(1, 2, 3), Vector3(4, 5, 6), Vector3(7, 8, 9))
    assert repr(v) == "<Basis(1, 2, 3, 4, 5, 6, 7, 8, 9)>"


@pytest.mark.parametrize(
    "field,ret_type,params",
    [
        ["inverse", Basis, ()],
        ["transposed", Basis, ()],