mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
issue27186: add C version of os.fspath(); patch by Jelle Zijlstra
This commit is contained in:
parent
c55014f371
commit
410ef8e230
6 changed files with 125 additions and 18 deletions
|
@ -3121,6 +3121,13 @@ class TestPEP519(unittest.TestCase):
|
|||
self.assertEqual(b"path/like/object", os.fsencode(pathlike))
|
||||
self.assertEqual("path/like/object", os.fsdecode(pathlike))
|
||||
|
||||
def test_fspathlike(self):
|
||||
class PathLike(object):
|
||||
def __fspath__(self):
|
||||
return '#feelthegil'
|
||||
|
||||
self.assertEqual('#feelthegil', os.fspath(PathLike()))
|
||||
|
||||
def test_garbage_in_exception_out(self):
|
||||
vapor = type('blah', (), {})
|
||||
for o in int, type, os, vapor():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue