'Ensure save_warnings_state/restore_warnings_state work correctly.'

def test_save_restore_warnings_state(self):

    import warnings
    self.save_warnings_state()
    class MyWarning(Warning, ):
        pass
    warnings.simplefilter('error', MyWarning)
    self.assertRaises(Warning, (lambda : warnings.warn('warn', MyWarning)))
    self.restore_warnings_state()
    warnings.simplefilter('ignore', MyWarning)
    warnings.warn('warn', MyWarning)
    self.restore_warnings_state()
