Пример #1
0
def test_gfx_attribs_as_dict():
    attribs = GfxAttribs(
        layer="Test",
        color=1,
        rgb=(0xA, 0xB, 0xC),
        linetype="SOLID",
        lineweight=50,
        transparency=0.5,
        ltscale=2,
    )
    expected = {
        "layer": "Test",
        "color": 1,
        "true_color": 0x0A0B0C,
        "linetype": "SOLID",
        "lineweight": 50,
        "transparency": 0x200007F,
        "ltscale": 2.0,
    }

    assert sorted(attribs.items()) == sorted(expected.items())
    assert attribs.asdict() == expected
    assert dict(attribs) == expected
Пример #2
0
def test_transparency_by_block_as_dict():
    attribs = GfxAttribs(transparency=gfxattribs.TRANSPARENCY_BYBLOCK, )
    expected = [("transparency", ezdxf.colors.TRANSPARENCY_BYBLOCK)]
    assert attribs.items() == expected
    assert attribs.asdict() == dict(expected)
    assert dict(attribs) == dict(expected)