Exemplo n.º 1
0
 def test_empty_section(self):
     section = EntitySection(Tags.from_text(EMPTYSEC), self.dwg)
     stream = StringIO()
     section.write(stream)
     result = stream.getvalue()
     stream.close()
     self.assertEqual(EMPTYSEC, result)
Exemplo n.º 2
0
class TestEntitySection(unittest.TestCase):
    def setUp(self):
        self.dwg = DrawingProxy('AC1009')
        self.section = EntitySection(Tags.from_text(TESTENTITIES), self.dwg)

    def test_write(self):
        stream = StringIO()
        self.section.write(stream)
        result = stream.getvalue()
        stream.close()
        self.assertEqual(normlines(TESTENTITIES), normlines(result))

    def test_empty_section(self):
        section = EntitySection(Tags.from_text(EMPTYSEC), self.dwg)
        stream = StringIO()
        section.write(stream)
        result = stream.getvalue()
        stream.close()
        self.assertEqual(EMPTYSEC, result)

    def test_iteration_with_layout_DXF12(self):
        dwg = ezdxf.new('AC1009')
        m = dwg.modelspace()
        m.add_line((0, 0), (1, 1))
        entity = list(dwg.entities)[-1]
        self.assertEqual(dwg, entity.drawing)  # check drawing attribute

    def test_iteration_with_layout_DXF2000(self):
        dwg = ezdxf.new('AC1015')
        m = dwg.modelspace()
        m.add_line((0, 0), (1, 1))
        entity = list(dwg.entities)[-1]
        self.assertEqual(dwg, entity.drawing)  # check drawing attribute

    def test_delete_all_entities_DXF12(self):
        dwg = ezdxf.new('AC1009')
        m = dwg.modelspace()
        for _ in range(5):
            m.add_line((0, 0), (1, 1))
        self.assertEqual(5, len(dwg.entities))

        dwg.entities.delete_all_entities()
        self.assertEqual(0, len(dwg.entities))
Exemplo n.º 3
0
 def setUp(self):
     self.dwg = DrawingProxy('AC1009')
     self.section = EntitySection(Tags.from_text(TESTENTITIES), self.dwg)