Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_line_reader(aio_file_maker, temp_file, uuid):
afp = await aio_file_maker(temp_file, 'w+')
writer = Writer(afp)
lines = [uuid4().hex for _ in range(1000)]
for line in lines:
await writer(line)
await writer('\n')
read_lines = []
async for line in LineReader(afp):
read_lines.append(line[:-1])
assert lines == read_lines
async def test_line_reader_one_line(aio_file_maker, temp_file):
afp = await aio_file_maker(temp_file, 'w+')
writer = Writer(afp)
payload = " ".join(uuid4().hex for _ in range(1000))
await writer(payload)
read_lines = []
async for line in LineReader(afp):
read_lines.append(line)
assert payload == read_lines[0]