'Only the first num_args arguments should matter to the cache'

@defer.inlineCallbacks
def test_cache_num_args(self):

    class Cls(object, ):
        def __init__(self):
            self.mock = mock.Mock()
        @descriptors.cached(num_args=1)
        def fn(self, arg1, arg2):
            return self.mock(arg1, arg2)
    obj = Cls()
    obj.mock.return_value = 'fish'
    r = (yield obj.fn(1, 2))
    self.assertEqual(r, 'fish')
    obj.mock.assert_called_once_with(1, 2)
    obj.mock.reset_mock()
    obj.mock.return_value = 'chips'
    r = (yield obj.fn(2, 3))
    self.assertEqual(r, 'chips')
    obj.mock.assert_called_once_with(2, 3)
    obj.mock.reset_mock()
    r = (yield obj.fn(1, 4))
    self.assertEqual(r, 'fish')
    r = (yield obj.fn(2, 5))
    self.assertEqual(r, 'chips')
    obj.mock.assert_not_called()
