Added 'read_bytes' without options and 'write_bytes'. Added tests for write_bytes and for Ruby. Doc fixed.

This commit is contained in:
Matthias Koefferlein
2024-11-30 18:46:25 +01:00
parent 41383e4642
commit e35aa97191
4 changed files with 98 additions and 3 deletions
+15
View File
@@ -1220,6 +1220,21 @@ class DBLayoutTest(unittest.TestCase):
l2 = ly2.layer(1, 0)
self.assertEqual(ly2.top_cell().bbox().to_s(), "(0,10;20,30)")
def test_write_bytes(self):
ly = pya.Layout()
top = ly.create_cell("TOP")
l1 = ly.layer(1, 0)
shape = top.shapes(l1).insert(pya.Box(0, 10, 20, 30))
options = pya.SaveLayoutOptions()
options.format = "GDS2"
byte_buffer = ly.write_bytes(options)
ly2 = pya.Layout()
ly2.read_bytes(byte_buffer)
l2 = ly2.layer(1, 0)
self.assertEqual(ly2.top_cell().bbox().to_s(), "(0,10;20,30)")
# run unit tests
if __name__ == '__main__':