Esempio n. 1
0
def test_value_types(entity, processor):
    attribs = DXFNamespace(processor, entity)
    attribs.handle = None  # None is always accepted, attribute is ignored at export
    assert attribs.handle is None
    attribs.handle = 'XYZ'
    assert attribs.handle == 'XYZ', 'handle is just a string'
    attribs.handle = 123
    assert attribs.handle == '123', 'handle is just a string'
    with pytest.raises(ValueError):
        attribs.color = 'xxx'

    attribs.start = (1, 2, 3)  # type: Vector
    assert attribs.start == (1, 2, 3)
    assert attribs.start.x == 1
    assert attribs.start.y == 2
    assert attribs.start.z == 3
def test_value_types(entity, processor):
    attribs = DXFNamespace(processor, entity)
    attribs.handle = (
        None  # None is always accepted, attribute is ignored at export
    )
    assert attribs.handle is None
    attribs.handle = "XYZ"
    assert attribs.handle == "XYZ", "handle is just a string"
    attribs.handle = 123
    assert attribs.handle == "123", "handle is just a string"
    with pytest.raises(ValueError):
        attribs.color = "xxx"

    attribs.start = (1, 2, 3)  # type: Vec3
    assert attribs.start == (1, 2, 3)
    assert attribs.start.x == 1
    assert attribs.start.y == 2
    assert attribs.start.z == 3