MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_clear_handler

Method test_clear_handler

Lib/test/test_sqlite3/test_hooks.py:184–197  ·  view source on GitHub ↗

Test that setting the progress handler to None clears the previously set handler.

(self)

Source from the content-addressed store, hash-verified

182 "create table bar (a, b)")
183
184 def test_clear_handler(self):
185 """
186 Test that setting the progress handler to None clears the previously set handler.
187 """
188 con = self.con
189 action = 0
190 def progress():
191 nonlocal action
192 action = 1
193 return 0
194 con.set_progress_handler(progress, 1)
195 con.set_progress_handler(None, 1)
196 con.execute("select 1 union select 2 union select 3").fetchall()
197 self.assertEqual(action, 0, "progress handler was not cleared")
198
199 @unittest.expectedFailure # TODO: RUSTPYTHON
200 @with_tracebacks(ZeroDivisionError, msg_regex="bad_progress")

Callers

nothing calls this directly

Calls 4

set_progress_handlerMethod · 0.80
fetchallMethod · 0.80
executeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected