| 27 | # Full-spin read-write tests |
| 28 | # This test is rather a smoke test |
| 29 | def rw_test(self, format): |
| 30 | |
| 31 | ly = pya.Layout() |
| 32 | cell = ly.create_cell("TOP") |
| 33 | l1 = ly.layer(1, 0) |
| 34 | cell.shapes(l1).insert(pya.Box(0, 0, 1000, 2000)) |
| 35 | cell.shapes(l1).insert(pya.Box(-100, -200, 2000, 1000)) |
| 36 | bbox = cell.bbox() |
| 37 | |
| 38 | opt = pya.SaveLayoutOptions() |
| 39 | opt.format = format |
| 40 | |
| 41 | b = ly.write_bytes(opt) |
| 42 | |
| 43 | ly2 = pya.Layout() |
| 44 | ly2.read_bytes(b) |
| 45 | |
| 46 | tc = ly.top_cell() |
| 47 | self.assertEqual(tc.name, "TOP") |
| 48 | self.assertEqual(str(tc.bbox()), str(bbox)) |
| 49 | |
| 50 | def test_gds2(self): |
| 51 | self.rw_test("GDS2") |