MCPcopy Create free account
hub / github.com/KLayout/klayout / test_read_bytes

Method test_read_bytes

testdata/python/dbLayoutTest.py:1197–1215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1195
1196
1197 def test_read_bytes(self):
1198
1199 testtmp = os.getenv("TESTTMP_WITH_NAME", os.getenv("TESTTMP", "."))
1200
1201 file_gds = os.path.join(testtmp, "bytes.gds")
1202
1203 ly = pya.Layout()
1204 top = ly.create_cell("TOP")
1205 l1 = ly.layer(1, 0)
1206 shape = top.shapes(l1).insert(pya.Box(0, 10, 20, 30))
1207 ly.write(file_gds)
1208
1209 with open(file_gds, "rb") as f:
1210 byte_buffer = f.read()
1211
1212 ly2 = pya.Layout()
1213 ly2.read_bytes(byte_buffer, pya.LoadLayoutOptions())
1214 l2 = ly2.layer(1, 0)
1215 self.assertEqual(ly2.top_cell().bbox().to_s(), "(0,10;20,30)")
1216
1217 def test_write_bytes(self):
1218

Callers

nothing calls this directly

Calls 12

openFunction · 0.85
LayoutMethod · 0.80
LoadLayoutOptionsMethod · 0.80
joinMethod · 0.45
create_cellMethod · 0.45
layerMethod · 0.45
insertMethod · 0.45
BoxMethod · 0.45
writeMethod · 0.45
readMethod · 0.45
to_sMethod · 0.45
bboxMethod · 0.45

Tested by

no test coverage detected