Skip to content

Commit

Permalink
Remove a nonstandard check and use assertRegex in two tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brunato committed Sep 15, 2024
1 parent 51a7e91 commit ff9b6e0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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'
)

Expand All @@ -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'
)

Expand Down

0 comments on commit ff9b6e0

Please sign in to comment.