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

    class _Object(object):

        def __init(self):
            pass

        @property
        @deprecation.deprecated(date, instructions)
        def _prop(self):
            'prop doc.\n\n        Returns:\n          String.\n        '
            return 'prop_with_doc'
    self.assertEqual(('prop doc. (deprecated)\n\nTHIS FUNCTION IS DEPRECATED. It will be removed after %s.\nInstructions for updating:\n%s\n\n        Returns:\n          String.\n        ' % (date, instructions)), getattr(_Object, '_prop').__doc__)
    self.assertEqual('prop_with_doc', _Object()._prop)
    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_prop_with_doc(self, mock_warning):
    date = '2016-07-04'
    instructions = 'This is how you update...'

    class _Object(object):

        def __init(self):
            pass

        @property
        @deprecation.deprecated(date, instructions)
        def _prop(self):
            'prop doc.\n\n        Returns:\n          String.\n        '
            return 'prop_with_doc'
    self.assertEqual(('prop doc. (deprecated)\n\nTHIS FUNCTION IS DEPRECATED. It will be removed after %s.\nInstructions for updating:\n%s\n\n        Returns:\n          String.\n        ' % (date, instructions)), getattr(_Object, '_prop').__doc__)
    self.assertEqual('prop_with_doc', _Object()._prop)
    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:]))