def test_read_2D_points(self): stri = string_tagger(POINT_2D_TAGS) tags = list(stri) tag = tags[0] # 2D point self.assertEqual((100, 200), tag.value) tag = tags[1] # check mark self.assertEqual('check mark 1', tag.value) tag = tags[2] # 3D point self.assertEqual((100, 200, 300), tag.value) tag = tags[3] # check mark self.assertEqual('check mark 2', tag.value)
def test_no_line_break_at_eof(self): tags = list(string_tagger(TAGS_NO_LINE_BREAK_AT_EOF)) self.assertEqual(3, len(tags)) self.assertEqual(DXFTag(10, (100, 200)), tags[1]) self.assertEqual(DXFTag(11, (1000, 2000)), tags[2])
def test_multiple_2d_coords(self): tags = list(string_tagger(TAGS_2D_COORDS2)) self.assertEqual(3, len(tags)) self.assertEqual(DXFTag(10, (100, 200)), tags[1]) self.assertEqual(DXFTag(11, (1000, 2000)), tags[2])
def test_2d_coords(self): tags = list(string_tagger(TAGS_2D_COORDS)) self.assertEqual(2, len(tags)) self.assertEqual(DXFTag(10, (100, 200)), tags[1])
def test_skip_comments(self): comments = [] tags = list(skip_comments(string_tagger(TAGS1), comments)) self.assertEqual(8, len(tags)) self.assertEqual('comment', comments[0])
def test_string(self): tags = list(string_tagger(TAGS1)) self.assertEqual(9, len(tags)) self.assertEqual(DXFTag(999, 'comment'), tags[0], 'should not skip comments.')
def test_float_to_int(self): tags = list(string_tagger(FLOAT_FOR_INT_TAGS)) self.assertEqual(int, type(tags[0].value))
def test_no_eof(self): tags = list(string_tagger(TEST_NO_EOF)) self.assertEqual(7, len(tags)) self.assertEqual((0, 'ENDSEC'), tags[-1])
def test_skip_comments(self): tags1 = list(skip_comments(string_tagger(TEST_TAGREADER))) tags2 = list(skip_comments(string_tagger(TEST_TAGREADER_COMMENTS))) self.assertEqual(tags1, tags2)
def test_ignore_struct_error(self): sections = Sections(string_tagger(TEST_NO_EOF), self.dwg) self.assertIsNotNone(self.sections.header)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.sections = Sections(string_tagger(TEST_HEADER), self.dwg)
def setUp(self): self.dwg = Drawing(string_tagger(MINIMALISTIC_DXF12))
def test_dxfversion(self): dwg = Drawing(string_tagger(TEST_HEADER)) self.assertEqual('AC1009', dwg.dxfversion)