def testMultiNestedOp(self):
    @gen.coroutine
    def _InnererMethod(client, arg3):
      self.assertTrue(Operation.GetCurrent().operation_id.startswith('++'))
      self.assertEqual(arg3, 3)
      self._method_count += 1

    @gen.coroutine
    def _InnerMethod(client, arg2):
      self.assertEqual(arg2, 2)
      self._method_count += 1
      if self._method_count == 2:
        yield Operation.CreateNested(client, '_InnererMethod', {'arg3': 3})

    @gen.coroutine
    def _OuterMethod(client, arg1):
      self.assertEqual(arg1, 1)
      self._method_count += 1
      if self._method_count == 1:
        yield Operation.CreateNested(client, '_InnerMethod', {'arg2': 2})

    # Create custom OpManager and make it the current instance for duration of test.
    op_mgr = self._CreateOpManager(handlers=[_OuterMethod, _InnerMethod, _InnererMethod])
    OpManager.SetInstance(op_mgr)

    outer_op = self._CreateTestOp(user_id=1, handler=_OuterMethod, arg1=1)
    self._RunAsync(op_mgr.WaitForUserOps, self._client, 1)
    self.assertEqual(self._method_count, 5)
Test nested op within nested op.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/test/op_manager_test.py/OpManagerTestCase.testMultiNestedOp