This commit is contained in:
2024-07-06 05:30:22 +03:00
parent d821273160
commit 7faf63809d

82
test.py
View File

@@ -1,80 +1,2 @@
import asyncio
import time
from limiter import BatchLimiter
async def test1():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_ozon('denco')
cnt += 1
print('ozon denco-1', cnt)
async def test2():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_ozon('denco')
cnt += 1
print('ozon denco-2', cnt)
async def test3():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_wildberries('denco')
cnt += 1
print('wb denco-1', cnt)
async def test4():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_wildberries('denco')
cnt += 1
print('wb denco-2', cnt)
async def test5():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_wildberries('denco')
cnt += 1
print('wb denco-2', cnt)
async def test6():
limiter = BatchLimiter()
cnt = 0
for i in range(100):
await limiter.acquire_ozon('bolgov')
cnt += 1
print('wb bolgov-1', cnt)
async def test():
start = time.time()
await asyncio.gather(*[
test1(),
# test2(),
# test3(),
# test4(),
# test5(),
# test6(),
])
print(time.time() - start)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(test())
if __name__ == '__main__':
main()
a = [1]
print(a[:1], a[1:])