Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
30
0.0
11
1.0
21
1.0
31
1.0
"""
class AttributeChecker(DXFEntity):
TEMPLATE = XTEMPLATE
DXFATTRIBS = DXFAttributes(
DefSubclass(None, {
'handle': DXFAttr(5),
'block_record': DXFAttr(330),
}),
DefSubclass('AcDbEntity', {
'paperspace': DXFAttr(67, default=0),
'layer': DXFAttr(8, default='0'),
'linetype': DXFAttr(6, default='BYLAYER'),
'ltscale': DXFAttr(48, default=1.0),
'invisible': DXFAttr(60, default=0),
'color': DXFAttr(62, default=256),
}),
DefSubclass('AcDbLine', {
'start': DXFAttr(10, XType.any_point),
'end': DXFAttr(11, XType.any_point),
'thickness': DXFAttr(39),
'extrusion': DXFAttr(210, XType.point3d),
}))
def test_box():
b = box(3, 2)
assert len(b) == 4
assert b == (Vector(0, 0), Vector(3, 0), Vector(3, 2), Vector(0, 2))
def test_closed_arrow():
a = arrow2(3, 60, 45)
assert len(a) == 4
assert a == (Vector(-3, 1.5), Vector(0, 0), Vector(-3, -1.5), Vector(-1.5, 0))
def test_vertext_attribs_xy():
result = vertex_attribs((1, 2), format='xy')
assert result == {'location': Vector(1, 2)}
def test_spline_transform_interface():
spline = Spline()
spline.set_uniform([(1, 0, 0), (3, 3, 0), (6, 0, 1)])
spline.dxf.start_tangent = Vector(1, 0, 0)
spline.dxf.end_tangent = Vector(2, 0, 0)
spline.dxf.extrusion = Vector(3, 0, 0)
spline.transform(Matrix44.translate(1, 2, 3))
assert spline.control_points[0] == (2, 2, 3)
# direction vectors are not transformed by translation
assert spline.dxf.start_tangent == (1, 0, 0)
assert spline.dxf.end_tangent == (2, 0, 0)
assert spline.dxf.extrusion == (3, 0, 0)
def test_new_AC1021():
dwg = ezdxf.new('AC1021')
assert 'AC1021' == dwg.dxfversion
def doc():
return ezdxf.new('R2007')
def sections():
dwg = ezdxf.new('R12')
return Sections(load_dxf_structure(internal_tag_compiler(TEST_HEADER)), dwg)
def test_drawing():
dwg = ezdxf.new('AC1024')
for attr in getattributes(DrawingProxy('AC1024')):
if not hasattr(dwg, attr):
raise Exception("attribute '%s' of DrawingProxy() does not exist in Drawing() class" % attr)
def doc():
return ezdxf.new('R2000')