Skip to content

Commit

Permalink
Add test about mixed newlines
Browse files Browse the repository at this point in the history
Just for case. That's a strange case, but it seems we pass it.
  • Loading branch information
kxepal committed Jan 14, 2019
1 parent d05a640 commit 4308069
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,34 @@ async def test_reading_skips_prelude(self, newline) -> None:
assert first.at_eof()
assert not second.at_eof()

async def test_read_mixed_newlines(self) -> None:
reader = aiohttp.MultipartReader(
{CONTENT_TYPE: 'multipart/mixed;boundary=":"'},
Stream(
b''.join([
b'--:\n',
b'Content-Type: multipart/related;boundary=--:--\n',
b'\n',
b'----:--\r\n',
b'\r\n',
b'test\r\n',
b'----:--\r\n',
b'\r\n',
b'passed\r\n',
b'----:----\r\n',
b'\n',
b'--:--',
])
)
)
while True:
part = await reader.next()
if part is None:
break
while True:
subpart = await part.next()
if subpart is None:
break

async def test_writer(writer) -> None:
assert writer.size == 0
Expand Down

0 comments on commit 4308069

Please sign in to comment.