mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 09:20:45 +02:00
Fixed the core issue (nil was not working as return value of a factory method)
This commit is contained in:
Vendored
+11
@@ -146,6 +146,13 @@ class PyGFactory(pya.GFactory):
|
||||
def f(self, z):
|
||||
return PyGObject(z)
|
||||
|
||||
class PyNilGFactory(pya.GFactory):
|
||||
def __init__(self):
|
||||
super(PyNilGFactory, self).__init__()
|
||||
# reimplementation of "virtual GObject *f(int)"
|
||||
def f(self, z):
|
||||
return None
|
||||
|
||||
class BasicTest(unittest.TestCase):
|
||||
|
||||
def test_00(self):
|
||||
@@ -3255,6 +3262,10 @@ class BasicTest(unittest.TestCase):
|
||||
go = None
|
||||
self.assertEqual(pya.GObject.g_inst_count(), gc)
|
||||
|
||||
gf = PyNilGFactory()
|
||||
go = pya.GFactory.create_f(gf, 17)
|
||||
self.assertEqual(go is None, True)
|
||||
|
||||
# fallback to __rmul__ for not implemented __mul__
|
||||
|
||||
def test_90(self):
|
||||
|
||||
Reference in New Issue
Block a user