Skip to content

Commit

Permalink
use readexactly() over read()
Browse files Browse the repository at this point in the history
  • Loading branch information
jquast committed Dec 21, 2015
1 parent 58a4c2f commit 98139ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions telnetlib3/tests/test_shell.py
Expand Up @@ -136,13 +136,13 @@ def test_telnet_given_shell(
host=bind_host, port=unused_tcp_port, loop=event_loop)

expected = IAC + DO + TTYPE
result = yield from reader.read(len(expected))
result = yield from reader.readexactly(len(expected))
assert result == expected

writer.write(IAC + WONT + TTYPE)

expected = b'Ready.\r\ntel:sh> '
result = yield from reader.read(len(expected))
result = yield from reader.readexactly(len(expected))
assert result == expected

cmd_output_table = (
Expand Down Expand Up @@ -237,7 +237,7 @@ def test_telnet_given_shell(
for (cmd, output_expected) in cmd_output_table:
writer.write(cmd)
result = yield from asyncio.wait_for(
reader.read(len(output_expected)), 0.5)
reader.readexactly(len(output_expected)), 0.5)
assert result == output_expected, cmd

# nothing more to read.
Expand Down

0 comments on commit 98139ad

Please sign in to comment.