Merge pull request #2015 from KLayout/bugfix/issue-2012

Bugfix/issue 2012
This commit is contained in:
Matthias Köfferlein
2025-04-05 19:21:35 +02:00
committed by GitHub
4 changed files with 58 additions and 21 deletions
+1 -1
View File
@@ -684,7 +684,7 @@ class DBLayoutTest(unittest.TestCase):
ly = pya.Layout(True)
pv = [ [ 17, "a" ], [ "b", [ 1, 5, 7 ] ] ]
pid = ly.properties_id( pv )
# does not work? @@@
# does not work?
# pv = { 17: "a", "b": [ 1, 5, 7 ] }
# pid2 = ly.properties_id( pv )
# self.assertEqual( pid, pid2 )
+13 -1
View File
@@ -24,7 +24,7 @@ import os
class DBShapesTest(unittest.TestCase):
# Shape objects as hashes
def test_12(self):
def test_1(self):
s = pya.Shapes()
s1 = s.insert(pya.Box(1, 2, 3, 4))
@@ -50,6 +50,18 @@ class DBShapesTest(unittest.TestCase):
self.assertEqual(h[s2], 2)
self.assertEqual(h[s3], 3)
# Issue #2012 (reference count)
def test_2(self):
ly = pya.Layout()
top = ly.create_cell("TOP")
l1 = ly.layer(1, 0)
top.shapes(l1).insert(pya.Box(0, 0, 100, 200))
shapes = top.shapes(l1)
self.assertEqual(sys.getrefcount(shapes), 2)
# run unit tests
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(DBShapesTest)