@testing.requires.savepoints
def test_begin_begin_nested_rollback_rollback(self):
    canary = mock.Mock()
    with testing.db.connect() as connection:
        event.listen(connection, 'rollback', canary.rollback)
        event.listen(connection, 'commit', canary.commit)
        trans = connection.begin()
        trans2 = connection.begin_nested()
        assert (connection.connection._reset_agent is trans)
        trans2.rollback()
        assert (connection.connection._reset_agent is trans)
        trans.rollback()
        assert (connection.connection._reset_agent is None)
    eq_(canary.mock_calls, [mock.call.rollback(connection)])
@testing.requires.savepoints
def test_begin_begin_nested_rollback_rollback(self):
    canary = mock.Mock()
    with testing.db.connect() as connection:
        event.listen(connection, 'rollback', canary.rollback)
        event.listen(connection, 'commit', canary.commit)
        trans = connection.begin()
        trans2 = connection.begin_nested()
        assert (connection.connection._reset_agent is trans)
        trans2.rollback()
        assert (connection.connection._reset_agent is trans)
        trans.rollback()
        assert (connection.connection._reset_agent is None)
    eq_(canary.mock_calls, [mock.call.rollback(connection)])