'Test that assertWarns cleans the warning registry, so the warning is
not swallowed the second time.'

def test_assertWarnsRegistryClean(self):

    def deprecated(a):
        warnings.warn('Woo    deprecated', category=DeprecationWarning)
        return a
    r1 = self.assertWarns(DeprecationWarning, 'Woo    deprecated', __file__, deprecated, 123)
    self.assertEqual(r1, 123)
    r2 = self.assertWarns(DeprecationWarning, 'Woo    deprecated', __file__, deprecated, 321)
    self.assertEqual(r2, 321)
