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
+6 -12
View File
@@ -16,10 +16,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import testprep
import klayout.QtCore
import klayout.QtGui
if not "QApplication" in klayout.QtGui.__all__:
import klayout.QtWidgets # Qt5
import klayout.db as db
import klayout.lay as lay
import unittest
import sys
@@ -29,15 +26,12 @@ import sys
class BasicTest(unittest.TestCase):
def test_1(self):
self.assertEqual("Annotation" in lay.__all__, True)
def test_2(self):
# Some smoke test
ant = lay.Annotation()
ant.style = lay.Annotation.StyleRuler
self.assertEqual(str(ant.style), str(lay.Annotation.StyleRuler))
ant.fmt_x = "abc"
self.assertEqual(ant.fmt_x, "abc")
lv = lay.LayoutView()
lv.resize(800, 600)
lv.zoom_box(db.DBox(-42, -17, 142, 117))
bx = lv.box()
self.assertEqual(str(bx), "(-42.09,-19.09;141.91,118.91)")
# run unit tests
if __name__ == '__main__':
+8
View File
@@ -18,6 +18,10 @@ import dbPolygonTest
import dbReaders
import dbRegionTest
import dbTransTest
import dbLayoutToNetlist
import dbLayoutVsSchematic
import dbNetlistCrossReference
import layLayers
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(tlTest.TLTest)
@@ -27,6 +31,10 @@ if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(dbReaders.DBReadersTests)
suite = unittest.TestLoader().loadTestsFromTestCase(dbRegionTest.DBRegionTest)
suite = unittest.TestLoader().loadTestsFromTestCase(dbTransTest.DBTransTests)
suite = unittest.TestLoader().loadTestsFromTestCase(dbLayoutToNetlist.DBLayoutToNetlistTests)
suite = unittest.TestLoader().loadTestsFromTestCase(dbLayoutVsSchematic.DBLayoutVsSchematicTests)
suite = unittest.TestLoader().loadTestsFromTestCase(dbNetlistCrossReference.DBNetlistCrossReferenceTests)
suite = unittest.TestLoader().loadTestsFromTestCase(layLayers.LAYLayersTests)
if not unittest.TextTestRunner(verbosity = 1).run(suite).wasSuccessful():
sys.exit(1)