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

Method test_deep1

testdata/python/dbRegionTest.py:43–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self.assertEqual(str(r), "(0,100;0,300;50,300;50,350;250,350;250,150;200,150;200,100)")
42
43 def test_deep1(self):
44
45 ut_testsrc = os.getenv("TESTSRC")
46
47 # construction/destruction magic ...
48 self.assertEqual(pya.DeepShapeStore.instance_count(), 0)
49 dss = pya.DeepShapeStore()
50 dss._create()
51 self.assertEqual(pya.DeepShapeStore.instance_count(), 1)
52 dss = None
53 self.assertEqual(pya.DeepShapeStore.instance_count(), 0)
54
55 dss = pya.DeepShapeStore()
56 ly = pya.Layout()
57 ly.read(os.path.join(ut_testsrc, "testdata", "algo", "deep_region_l1.gds"))
58 l1 = ly.layer(1, 0)
59 r = pya.Region(ly.top_cell().begin_shapes_rec(l1), dss)
60 rf = pya.Region(ly.top_cell().begin_shapes_rec(l1))
61
62 self.assertEqual(r.area(), 53120000)
63 self.assertEqual(rf.area(), 53120000)
64
65 ly_new = pya.Layout()
66 tc = ly_new.add_cell("TOP")
67 l1 = ly_new.layer(1, 0)
68 l2 = ly_new.layer(2, 0)
69 ly_new.insert(tc, l1, r)
70 ly_new.insert(tc, l2, rf)
71
72 s1 = { }
73 s2 = { }
74 for cell in ly_new.each_cell():
75 s1[cell.name] = cell.shapes(l1).size()
76 s2[cell.name] = cell.shapes(l2).size()
77 self.assertEqual(s1, {"INV2": 1, "TOP": 0, "TRANS": 0})
78 self.assertEqual(s2, {"INV2": 0, "TOP": 10, "TRANS": 0})
79
80 # force destroy, so the unit tests pass on the next iteration
81 dss = None
82 self.assertEqual(pya.DeepShapeStore.instance_count(), 0)
83
84 # begin_shapes_rec and begin_shapes_merged_rec
85 def test_extended_iter(self):

Callers

nothing calls this directly

Calls 11

add_cellMethod · 0.95
insertMethod · 0.95
DeepShapeStoreMethod · 0.80
LayoutMethod · 0.80
RegionMethod · 0.80
instance_countMethod · 0.45
readMethod · 0.45
joinMethod · 0.45
layerMethod · 0.45
areaMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected