@tf.test.mock.patch.object(logging, 'warning', autospec=True)
def test_varargs(self, mock_warning):
    date = '2016-07-04'
    instructions = 'This is how you update...'

    @deprecation.deprecated_args(date, instructions, 'deprecated')
    def _fn(arg0, arg1, *deprecated):
        return ((arg0 + arg1) if deprecated else (arg1 + arg0))
    self.assertEqual(3, _fn(1, 2))
    self.assertEqual(0, mock_warning.call_count)
    self.assertEqual(3, _fn(1, 2, True, False))
    self.assertEqual(1, mock_warning.call_count)
    (args, _) = mock_warning.call_args
    self.assertRegexpMatches(args[0], 'deprecated and will be removed after')
    self._assert_subset(set([date, instructions]), set(args[1:]))
@tf.test.mock.patch.object(logging, 'warning', autospec=True)
def test_varargs(self, mock_warning):
    date = '2016-07-04'
    instructions = 'This is how you update...'

    @deprecation.deprecated_args(date, instructions, 'deprecated')
    def _fn(arg0, arg1, *deprecated):
        return ((arg0 + arg1) if deprecated else (arg1 + arg0))
    self.assertEqual(3, _fn(1, 2))
    self.assertEqual(0, mock_warning.call_count)
    self.assertEqual(3, _fn(1, 2, True, False))
    self.assertEqual(1, mock_warning.call_count)
    (args, _) = mock_warning.call_args
    self.assertRegexpMatches(args[0], 'deprecated and will be removed after')
    self._assert_subset(set([date, instructions]), set(args[1:]))