'Test assertWarns works when used on an instance method.'

def test_assertWarnsOnMethod(self):

    class Warn:
        def deprecated(self, a):
            warnings.warn('Bar    deprecated', category=DeprecationWarning)
            return a
    w = Warn()
    r = self.assertWarns(DeprecationWarning, 'Bar    deprecated', __file__, w.deprecated, 321)
    self.assertEqual(r, 321)
    r = self.assertWarns(DeprecationWarning, 'Bar    deprecated', __file__, w.deprecated, 321)
    self.assertEqual(r, 321)
