def testBaseModelMemcacheAddAutoUpdateTask(self):

    class _BaseModel(models.BaseModel):
      pass

    # nothing set yet
    self.assertFalse(hasattr(_BaseModel, '_memcache_auto_update_tasks'))

    # attempt to use a task that doesn't exist
    self.assertRaises(
        ValueError,
        _BaseModel.MemcacheAddAutoUpdateTask,
        'func', 1, foo='bar')
    self.assertFalse(hasattr(_BaseModel, '_memcache_auto_update_tasks'))

    # attempt to use non-executable attribute as task
    _BaseModel.NotAFunction = 1
    self.assertRaises(
        ValueError,
        _BaseModel.MemcacheAddAutoUpdateTask,
        'NotAFunction', 1, foo='bar')
    self.assertFalse(hasattr(_BaseModel, '_memcache_auto_update_tasks'))

    # successful
    _BaseModel.MemcacheAddAutoUpdateTask('ResetMemcacheWrap', 1, foo='bar')
    self.assertEqual(
        _BaseModel._memcache_auto_update_tasks,
        [('ResetMemcacheWrap', (1,), {'foo': 'bar'})])
Test BaseModel.MemcacheAddAutoUpdateTask().
dataset/ETHPy150Open google/simian/src/tests/simian/mac/models/base_test.py/ModelsModuleTest.testBaseModelMemcacheAddAutoUpdateTask