From 8678feaa592755ded772afa8f34e3e76b19cdf01 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 22 Apr 2019 19:50:32 +0100 Subject: [PATCH] Make TestRobotsTxt Python 3.7 compatible urllib.parse.quote() moved from RFC 2396 to RFC 3986 for quoting URL strings. "~" is now included in the set of reserved characters. https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote --- tests/test_robotstxt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_robotstxt.py b/tests/test_robotstxt.py index 799ac5a8..f2e8b659 100644 --- a/tests/test_robotstxt.py +++ b/tests/test_robotstxt.py @@ -18,6 +18,7 @@ Test robots.txt parsing. """ +import sys import unittest import linkcheck.robotparser2 @@ -224,7 +225,8 @@ class TestRobotsTxt (unittest.TestCase): "Disallow: /tmp", "Disallow: /a%3Cd.html", "Disallow: /a/b.html", - "Disallow: /%7Ejoe/index.html", + "Disallow: /%7Ejoe/index.html" if sys.version_info < (3, 7) \ + else "Disallow: /~joe/index.html", ] self.rp.parse(lines) self.assertEqual(str(self.rp), "\n".join(lines2)) @@ -249,7 +251,8 @@ class TestRobotsTxt (unittest.TestCase): "Disallow: /tmp/", "Disallow: /a%3Cd.html", "Disallow: /a/b.html", - "Disallow: /%7Ejoe/index.html", + "Disallow: /%7Ejoe/index.html" if sys.version_info < (3, 7) \ + else "Disallow: /~joe/index.html", ] self.rp.parse(lines) self.assertEqual(str(self.rp), "\n".join(lines2))