def test_flat_DXFList(self): atoms = DXFList() atoms.append(DXFAtom('HEADER')) atoms.append(DXFAtom('SECTION', 1)) self.assertEqual(dxfstr(atoms), ' 0\nHEADER\n 1\nSECTION\n') result = tags2str(atoms) self.assertEqual(dxfstr(atoms), result)
def _get_body(self): """ Return header section content as DXFList. """ varlist = [ DXFList((DXFAtom(key, 9), value)) for key, value in self.variables.items() ] return DXFList((DXFName('HEADER'), DXFList(varlist)))
def __dxftags__(self): return DXFList( (DXFAtom('SECTION'), DXFList(self._get_body()), DXFAtom('ENDSEC')))
def test_Sublists(self): atoms = DXFList([ DXFList([ DXFAtom('TAG1'), DXFAtom('TAG2'), DXFList([ DXFAtom('TAG14'), DXFAtom('TAG15'), DXFAtom('TAG16'), ]), DXFAtom('TAG3'), ]), DXFList([ DXFAtom('TAG4'), DXFAtom('TAG5'), DXFAtom('TAG6'), DXFList([ DXFAtom('TAG11'), DXFAtom('TAG12'), DXFAtom('TAG13'), ]), ]), DXFAtom('TAG7'), ]) self.assertEqual(dxfstr(atoms), tags2str(atoms))
def test_group_code_1000(self): atom = DXFAtom('SECTION', 1000) self.assertEqual(dxfstr(atom), '1000\nSECTION\n') self.assertEqual(dxfstr(atom), tags2str(atom))
def test_group_code_0(self): atom = DXFAtom('HEADER', 0) self.assertEqual(dxfstr(atom), ' 0\nHEADER\n') self.assertEqual(dxfstr(atom), tags2str(atom))