def METHOD_NAME(self):
    session = MagicMock()
    fake_results = [1000, 1000, 500]
    def fake_execute_delete1(stmt):
        result = MagicMock()
        result.rowcount = fake_results.pop(0)
        return result
    session.execute.side_effect = fake_execute_delete1
    # delete chunked
    result = delete_matching_rows(session, LogEntry.__table__, LogEntry.id < 1234, 1000)
    # was called three times to delete 2500 entries
    self.assertEqual(len(session.execute.mock_calls), 3)
    self.assertEqual(result, 2500)
    session.execute.reset_mock()
    def fake_execute_delete2(stmt):
        result = MagicMock()
        result.rowcount = 2500
        return result
    session.execute.side_effect = fake_execute_delete2
    # delete in one statement
    result = delete_matching_rows(session, LogEntry.__table__, LogEntry.id < 1234)
    self.assertEqual(len(session.execute.mock_calls), 1)
    self.assertEqual(result, 2500