def test_CursorWrongClass(self): class Foo: ... foo = Foo() with self.assertRaises(TypeError): cur = monetdbe.Cursor(foo)
def test_Bpo31770(self): """ The interpreter shouldn't crash in case Cursor.__init__() is called more than once. """ def callback(*args): pass con = monetdbe.connect(":memory:") cur = monetdbe.Cursor(con) ref = weakref.ref(cur, callback) cur.__init__(con) del cur # The interpreter shouldn't crash when ref is collected. del ref gc.collect()