Skip to content

Commit

Permalink
Simplify buffer comparison assertion while also improving failure mes…
Browse files Browse the repository at this point in the history
…sages

Th inherited assertEqual used to produce crummy output in this case but now it
does a pretty good job.
  • Loading branch information
exarkun committed Sep 6, 2022
1 parent ce653e9 commit 9d2a558
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/twisted/conch/test/test_recvline.py
Expand Up @@ -473,15 +473,7 @@ class _BaseMixin:
def _assertBuffer(self, lines):
receivedLines = self.recvlineClient.__bytes__().splitlines()
expectedLines = lines + ([b""] * (self.HEIGHT - len(lines) - 1))
self.assertEqual(len(receivedLines), len(expectedLines))
for i in range(len(receivedLines)):
self.assertEqual(
receivedLines[i],
expectedLines[i],
b"".join(receivedLines[max(0, i - 1) : i + 1])
+ b" != "
+ b"".join(expectedLines[max(0, i - 1) : i + 1]),
)
self.assertEqual(receivedLines, expectedLines)

def _trivialTest(self, inputLine, output):
done = self.recvlineClient.expect(b"done")
Expand Down

0 comments on commit 9d2a558

Please sign in to comment.