Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_write_dxf():
entity = Helix.from_text(HELIX)
result = TagCollector.dxftags(entity)
expected = basic_tags_from_text(HELIX)
assert result == expected
def test_write_dxf_r12(entity):
collector = TagCollector(dxfversion=DXF12)
entity.export_dxf(collector)
assert len(collector.tags) == 0
def test_write_dxf(txt, ver):
expected = basic_tags_from_text(txt)
shape = TEST_CLASS.from_text(txt)
collector = TagCollector(dxfversion=ver, optional=True)
shape.export_dxf(collector)
assert collector.tags == expected
collector2 = TagCollector(dxfversion=ver, optional=False)
shape.export_dxf(collector2)
assert collector.has_all_tags(collector2)
def test_write_dxf():
entity = Leader.from_text(LEADER)
result = TagCollector.dxftags(entity)
expected = basic_tags_from_text(LEADER)
assert result == expected
def test_write_dxf():
entity = Tolerance.from_text(TOLERANCE)
result = TagCollector.dxftags(entity)
expected = basic_tags_from_text(TOLERANCE)
assert result == expected
def test_write_dxf():
entity = XLine.from_text(XLINE)
result = TagCollector.dxftags(entity)
expected = basic_tags_from_text(XLINE)
assert result == expected
def test_write_r12_dxf(entity):
tagwriter = TagCollector(dxfversion=DXF12)
entity.export_dxf(tagwriter)
tag = tagwriter.tags
assert len(tag) == 2
assert tag[0] == (0, 'DXFENTITY')
assert tag[1] == (5, 'FFFF')
def test_no_fit_points_export(spline_edge_hatch):
path = spline_edge_hatch.paths[0]
spline = path.add_spline(control_points=[(1, 1), (2, 2), (3, 3), (4, 4)], degree=3, rational=1, periodic=1)
spline.knot_values = [1, 2, 3, 4, 5, 6]
assert [(1, 1), (2, 2), (3, 3), (4, 4)] == spline.control_points
assert len(spline.fit_points) == 0
writer = TagCollector(dxfversion=DXF2007)
spline.export_dxf(writer)
# do not write length tag 97 if no fit points exists for DXF2007 and prior
assert any(tag.code == 97 for tag in writer.tags) is False
writer = TagCollector(dxfversion=DXF2010)
spline.export_dxf(writer)
# do write length tag 97 if no fit points exists for DXF2010+
assert (97, 0) in writer.tags
def test_write_dxf():
entity = Ray.from_text(RAY)
result = TagCollector.dxftags(entity)
expected = basic_tags_from_text(RAY)
assert result == expected
def test_write_dxf(txt, ver):
expected = basic_tags_from_text(txt)
circle = TEST_CLASS.from_text(txt)
collector = TagCollector(dxfversion=ver, optional=True)
circle.export_dxf(collector)
assert collector.tags == expected
collector2 = TagCollector(dxfversion=ver, optional=False)
circle.export_dxf(collector2)
assert collector.has_all_tags(collector2)