# Path: aiosmtplib/compat.py
# PY37_OR_LATER = sys.version_info[:2] >= (3, 7)
# 
# def all_tasks(loop: asyncio.AbstractEventLoop = None):
#     if PY37_OR_LATER:
#         return asyncio.all_tasks(loop=loop)
# 
#     return asyncio.Task.all_tasks(loop=loop)  # type: ignore
# 
# def get_running_loop() -> asyncio.AbstractEventLoop:
#     if PY37_OR_LATER:
#         return asyncio.get_running_loop()
# 
#     loop = asyncio.get_event_loop()
#     if not loop.is_running():
#         raise RuntimeError("no running event loop")
# 
#     return loop


import asyncio
import pytest
from aiosmtplib.compat import PY37_OR_LATER, all_tasks, get_running_loop
"""
Compat method tests.
"""




@pytest.mark.asyncio
async def test_get_running_loop(event_loop):
    running_loop = get_running_loop()
    assert running_loop is event_loop


def test_get_running_loop_runtime_error(event_loop):
    with pytest.raises(RuntimeError):

# Path: aiosmtplib/compat.py
# PY37_OR_LATER = sys.version_info[:2] >= (3, 7)
# 
# def all_tasks(loop: asyncio.AbstractEventLoop = None):
#     if PY37_OR_LATER:
#         return asyncio.all_tasks(loop=loop)
# 
#     return asyncio.Task.all_tasks(loop=loop)  # type: ignore
# 
# def get_running_loop() -> asyncio.AbstractEventLoop:
#     if PY37_OR_LATER:
#         return asyncio.get_running_loop()
# 
#     loop = asyncio.get_event_loop()
#     if not loop.is_running():
#         raise RuntimeError("no running event loop")
# 
#     return loop


# Path: tests/test_compat.py
import asyncio
import pytest
from aiosmtplib.compat import PY37_OR_LATER, all_tasks, get_running_loop

"""
Compat method tests.
"""




@pytest.mark.asyncio
async def test_get_running_loop(event_loop):
    running_loop = get_running_loop()
    assert running_loop is event_loop


def test_get_running_loop_runtime_error(event_loop):
    with pytest.raises(RuntimeError):

        get_running_loop()