<commit_before>import datetime

import aiohttp
import pytest

from .. import aiohttp as gh_aiohttp
from .. import sansio


async def call_aiohttp(what, *args, **kwargs):
    async with aiohttp.ClientSession() as session:
        gh = gh_aiohttp.GitHubAPI(session, "gidgethub")
        return await getattr(gh, what)(*args, **kwargs)


@pytest.mark.asyncio
async def test_sleep():
    delay = 1
    start = datetime.datetime.now()
    async with aiohttp.ClientSession() as session:
        gh = gh_aiohttp.GitHubAPI(session, "gidgethub")
        await gh._sleep(delay)
    stop = datetime.datetime.now()
    assert (stop - start) > datetime.timedelta(seconds=delay)


@pytest.mark.asyncio
async def test_request():
    request_headers = sansio.create_headers("gidgethub")
    async with aiohttp.ClientSession() as session:
        gh = gh_aiohttp.GitHubAPI(session, "gidgethub")
        aio_call = await gh._request("GET", "https://api.github.com/rate_limit",
                                     request_headers)
    data, rate_limit, _ = sansio.decipher_response(*aio_call)
    assert "rate" in data<commit_msg>Delete call_aiohttp() (#8)<commit_after>import datetime

import aiohttp
import pytest

from .. import aiohttp as gh_aiohttp
from .. import sansio


@pytest.mark.asyncio
async def test_sleep():
    delay = 1
    start = datetime.datetime.now()
    async with aiohttp.ClientSession() as session:
        gh = gh_aiohttp.GitHubAPI(session, "gidgethub")
        await gh._sleep(delay)
    stop = datetime.datetime.now()
    assert (stop - start) > datetime.timedelta(seconds=delay)


@pytest.mark.asyncio
async def test_request():
    request_headers = sansio.create_headers("gidgethub")
    async with aiohttp.ClientSession() as session:
        gh = gh_aiohttp.GitHubAPI(session, "gidgethub")
        aio_call = await gh._request("GET", "https://api.github.com/rate_limit",
                                     request_headers)
    data, rate_limit, _ = sansio.decipher_response(*aio_call)
    assert "rate" in data
{'fraction_non_alphanumeric': 0.1091358024691358, 'fraction_numerical': 0.0014814814814814814, 'mean_word_length': 3.2742616033755274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4415369', 'n_tokens_mistral': 669, 'n_tokens_neox': 651, 'n_words': 147}