File: test_aio.py

package info (click to toggle)
python-ratelimiter 1.2.0.post0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 140 kB
  • sloc: python: 208; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 312 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest

from ratelimiter import RateLimiter

@pytest.mark.asyncio
async def test_alock():
    rl = RateLimiter(max_calls=10, period=0.01)

    assert rl._alock is None

    async with rl:
        pass

    alock = rl._alock
    assert alock

    async with rl:
        pass

    assert rl._alock is alock