'Subsequent emissions of a warning from a particular source site can be
collected by L{_collectWarnings}.  In particular, the per-module
emitted-warning cache should be bypassed (I{__warningregistry__}).'

def test_duplicateWarningCollected(self):

    global __warningregistry__
    del __warningregistry__
    def f():
        warnings.warn('foo')
    warnings.simplefilter('default')
    f()
    events = []
    _collectWarnings(events.append, f)
    self.assertEqual(len(events), 1)
    self.assertEqual(events[0].message, 'foo')
    self.assertEqual(len(self.flushWarnings()), 1)
