Skip to content

Commit

Permalink
more win32 shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jan 31, 2020
1 parent 3efc0d8 commit 6d0db5e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions testing/path/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,11 +1116,15 @@ def test_behavior_with_bytes(): # type: () -> None
assert p1 / brelpath == local("") / local("bytesname")
assert str(p1 / brelpath) == str(local("") / local("bytesname"))
else:
assert p1 / brelpath != local("") / local("bytesname")
with pytest.raises(
TypeError, match=r"__str__ returned non-string \(type bytes\)"
):
str(p1 / brelpath)

strpath = (p1 / brelpath).strpath.decode()
assert strpath == str(local("") / local("bytesname"))
if sys.platform == "win32":
with pytest.raises(TypeError, "a bytes-like object is required, not 'str'"):
p1 / brelpath
else:
assert p1 / brelpath != local("") / local("bytesname")
with pytest.raises(
TypeError, match=r"__str__ returned non-string \(type bytes\)"
):
str(p1 / brelpath)

strpath = (p1 / brelpath).strpath.decode()
assert strpath == str(local("") / local("bytesname"))

0 comments on commit 6d0db5e

Please sign in to comment.