mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-02 03:44:43 +00:00
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
This commit is contained in:
parent
5d26d2d93e
commit
8678feaa59
1 changed files with 5 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
Test robots.txt parsing.
|
Test robots.txt parsing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import linkcheck.robotparser2
|
import linkcheck.robotparser2
|
||||||
|
|
||||||
|
|
@ -224,7 +225,8 @@ class TestRobotsTxt (unittest.TestCase):
|
||||||
"Disallow: /tmp",
|
"Disallow: /tmp",
|
||||||
"Disallow: /a%3Cd.html",
|
"Disallow: /a%3Cd.html",
|
||||||
"Disallow: /a/b.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.rp.parse(lines)
|
||||||
self.assertEqual(str(self.rp), "\n".join(lines2))
|
self.assertEqual(str(self.rp), "\n".join(lines2))
|
||||||
|
|
@ -249,7 +251,8 @@ class TestRobotsTxt (unittest.TestCase):
|
||||||
"Disallow: /tmp/",
|
"Disallow: /tmp/",
|
||||||
"Disallow: /a%3Cd.html",
|
"Disallow: /a%3Cd.html",
|
||||||
"Disallow: /a/b.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.rp.parse(lines)
|
||||||
self.assertEqual(str(self.rp), "\n".join(lines2))
|
self.assertEqual(str(self.rp), "\n".join(lines2))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue