File: test_async_api.py

package info (click to toggle)
pydataverse 0.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,168 kB
  • sloc: python: 4,862; sh: 61; makefile: 13
file content (14 lines) | stat: -rw-r--r-- 417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import asyncio
import pytest


class TestAsyncAPI:
    @pytest.mark.asyncio
    async def test_async_api(self, native_api):
        async with native_api:
            tasks = [native_api.get_info_version() for _ in range(10)]
            responses = await asyncio.gather(*tasks)

        assert len(responses) == 10
        for response in responses:
            assert response.status_code == 200, "Request failed."