From ff9b6e07651c3a9e691d04069e9de54729a99c95 Mon Sep 17 00:00:00 2001 From: Davide Brunato Date: Sun, 15 Sep 2024 16:44:21 +0200 Subject: [PATCH] Remove a nonstandard check and use assertRegex in two tests --- tests/test_locations.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/test_locations.py b/tests/test_locations.py index 80b1cbde..0340adb9 100644 --- a/tests/test_locations.py +++ b/tests/test_locations.py @@ -169,11 +169,11 @@ def test_path_from_uri(self): path = LocationPosixPath.from_uri('file:///home/foo/names/?name=foo') self.assertIsInstance(path, default_class) - self.assertEqual(str(path), '/home/foo/names') + self.assertEqual(str(path).replace('\\', '/'), '/home/foo/names') path = LocationPosixPath.from_uri('file:///home/foo/names#foo') self.assertIsInstance(path, default_class) - self.assertEqual(str(path), '/home/foo/names') + self.assertEqual(str(path).replace('\\', '/'), '/home/foo/names') path = LocationPath.from_uri('file:///home\\foo\\names#foo') self.assertTrue(path.as_posix().endswith('/home/foo/names')) @@ -209,9 +209,7 @@ def test_get_uri(self): # Test urlsplit() roundtrip with urlunsplit() for url in URL_CASES: if url == 'file:other.xsd': - # https://datatracker.ietf.org/doc/html/rfc8089#appendix-E.2.1 - if sys.version_info < (3, 13): - self.assertNotEqual(urlsplit(url).geturl(), url) + pass # Nonstandard: https://datatracker.ietf.org/doc/html/rfc8089#appendix-E.2.1 elif url.startswith(('////', 'file:////')) and not is_unc_path('////'): self.assertNotEqual(urlsplit(url).geturl(), url) else: @@ -374,7 +372,7 @@ def test_normalize_url_with_base_unc_path(self,): if is_unc_path('////filer01/MY_HOME/'): self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') else: - self.assertEqual( + self.assertRegex( url, f'file://{DRIVE_REGEX}/filer01/MY_HOME/dev/XMLSCHEMA/test.xsd' ) @@ -393,7 +391,7 @@ def test_normalize_url_with_base_unc_path(self,): if is_unc_path('////'): self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') else: - self.assertEqual( + self.assertRegex( url, f'file://{DRIVE_REGEX}/filer01/MY_HOME/dev/XMLSCHEMA/test.xsd' )