Python module tests generalized

This commit is contained in:
Matthias Koefferlein
2022-05-15 20:17:23 +02:00
parent 104975a14e
commit 249642d5f3
7 changed files with 45 additions and 67 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ import unittest
import sys
import os
class DBLayoutToNetlistTests(unittest.TestCase):
class DBLayoutVsSchematicTests(unittest.TestCase):
def test_1_Basic(self):
+1 -1
View File
@@ -23,7 +23,7 @@ import unittest
import sys
import os
class DBLayoutToNetlistTests(unittest.TestCase):
class DBNetlistCrossReferenceTests(unittest.TestCase):
def test_1_Basic(self):
+26 -52
View File
@@ -27,7 +27,7 @@ def astr(a):
astr.append(str(i))
return "[" + ", ".join(astr) + "]"
class LAYLayersTest(unittest.TestCase):
class LAYLayersTests(unittest.TestCase):
def lnode_str(self, space, l):
return space + l.current().source_(True) + "\n";
@@ -57,14 +57,9 @@ class LAYLayersTest(unittest.TestCase):
def test_1(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", 1)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", 2)
cv = mw.current_view()
cv = pya.LayoutView()
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", True)
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", True)
cv.clear_layers()
@@ -203,18 +198,15 @@ class LAYLayersTest(unittest.TestCase):
self.assertEqual(self.lnodes_str("", cv.begin_layers()), "*/*@*\n 1/0@1\n 1/0@2\n%5@2\n %5@2\n")
mw.close_all()
cv._destroy()
def test_1a(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
mgr = pya.Manager()
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", 1)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", 2)
cv = mw.current_view()
cv = pya.LayoutView(False, mgr)
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", True)
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", True)
cv.clear_layers()
@@ -396,7 +388,7 @@ class LAYLayersTest(unittest.TestCase):
cv.delete_layers(0, a)
self.assertEqual(cv.begin_layers(0).at_end(), True)
cv.commit()
mw.cm_undo()
mgr.undo()
self.assertEqual(cv.begin_layers(0).at_end(), False)
cv.transaction("Delete")
@@ -407,10 +399,10 @@ class LAYLayersTest(unittest.TestCase):
self.assertEqual(i, 2)
self.assertEqual(cv.begin_layers(0).at_end(), True)
cv.commit()
mw.cm_undo()
mgr.undo()
self.assertEqual(cv.begin_layers(0).at_end(), False)
mw.close_all()
cv._destroy()
def test_2(self):
@@ -655,14 +647,10 @@ class LAYLayersTest(unittest.TestCase):
# direct replacement of objects and attributes
def test_3(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
cv = pya.LayoutView()
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", pya.LoadLayoutOptions(), "", True)
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", pya.LoadLayoutOptions(), "", True)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", pya.LoadLayoutOptions(), "", 1)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", pya.LoadLayoutOptions(), "", 2)
cv = mw.current_view()
self.assertEqual(self.lnodes_str("", cv.begin_layers()), "1/0@1\n2/0@1\n1/0@2\n2/0@2\n3/0@2\n3/1@2\n4/0@2\n5/0@2\n6/0@2\n6/1@2\n7/0@2\n8/0@2\n8/1@2\n")
cv.clear_layers()
@@ -772,19 +760,14 @@ class LAYLayersTest(unittest.TestCase):
self.assertEqual(self.lnodes_str("", cv.begin_layers()), "TOP@1\n nn1@1\n nn1@1\n")
self.assertEqual(self.lnodes_str2(cv), "TOP@1\nnn1@1\nnn1@1")
mw.close_all()
cv._destroy()
# propagation of "real" attributes through the hierarchy
def test_4(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", 1)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", 2)
cv = mw.current_view()
cv = pya.LayoutView()
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", True)
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", True)
cv.clear_layers()
@@ -807,18 +790,14 @@ class LAYLayersTest(unittest.TestCase):
self.assertEqual(pos.first_child().current().visible_(True), False)
self.assertEqual(pos.first_child().current().visible_(False), True)
mw.close_all()
cv._destroy()
# delete method of iterator
def test_5(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
cv = pya.LayoutView()
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", True)
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", 1)
cv = mw.current_view()
cv.clear_layers()
new_p = pya.LayerProperties()
@@ -899,18 +878,13 @@ class LAYLayersTest(unittest.TestCase):
self.assertEqual(pc.at_end(), True)
self.assertEqual(pc.current().is_valid(), False)
mw.close_all()
cv._destroy()
# custom stipples and line styles
def test_6(self):
app = pya.Application.instance()
mw = app.main_window()
mw.close_all()
mw.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", 1)
cv = mw.current_view()
cv = pya.LayoutView()
cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", True)
cv.clear_stipples()
@@ -944,7 +918,7 @@ class LAYLayersTest(unittest.TestCase):
cv.clear_line_styles()
self.assertEqual(cv.get_line_style(index), "")
mw.close_all()
cv._destroy()
# run unit tests