# HG changeset patch # Parent 95df96aa2f5a03eab9d98324c4c4e2993b1ebb0f Issue #19613: Rewrite over-strict test for articles ending with a dot diff -r 95df96aa2f5a -r 3bbe64617a14 Lib/test/test_nntplib.py --- a/Lib/test/test_nntplib.py Tue Jul 26 12:23:16 2016 -0400 +++ b/Lib/test/test_nntplib.py Wed Jul 27 03:07:59 2016 +0000 @@ -161,8 +161,6 @@ self.assertEqual(article.number, art_num) for line in article.lines: self.assertIsInstance(line, bytes) - # XXX this could exceptionally happen... - self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n")) def test_article_head_body(self): resp, count, first, last, name = self.server.group(self.GROUP_NAME) @@ -180,12 +178,16 @@ self.skipTest("could not find a suitable article number") self.assertTrue(resp.startswith("221 "), resp) self.check_article_resp(resp, head, art_num) + self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n")) resp, body = self.server.body(art_num) self.assertTrue(resp.startswith("222 "), resp) self.check_article_resp(resp, body, art_num) + if article.lines: + self.assertFalse(article.lines[-1].endswith(b"\n")) resp, article = self.server.article(art_num) self.assertTrue(resp.startswith("220 "), resp) self.check_article_resp(resp, article, art_num) + self.assertFalse(article.lines[-1].endswith(b"\n")) # Tolerate running the tests from behind a NNTP virus checker blacklist = lambda line: line.startswith(b'X-Antivirus') filtered_head_lines = [line for line in head.lines