Review: simpler implementation and test

Because **all** the path are bytestrings
This commit is contained in:
MartyLake 2019-07-24 18:09:54 +02:00
parent 819f03f0e0
commit fb96660171
2 changed files with 2 additions and 4 deletions

View file

@ -227,8 +227,6 @@ def path_as_posix(path):
"""Return the string representation of the path with forward (/)
slashes.
"""
if isinstance(path, str):
return path.replace('\\', '/')
return path.replace(b'\\', b'/')

View file

@ -196,8 +196,8 @@ class HelperTest(_common.TestCase):
self.assertEqual(util.components(p), a)
def test_forward_slash(self):
p = r'C:\a\b\c'
a = r'C:/a/b/c'
p = br'C:\a\b\c'
a = br'C:/a/b/c'
self.assertEqual(util.path_as_posix(p), a)