Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return

type of __fspath__().

As part of this change, also make sure that the pure Python
implementation of os.fspath() is tested.
This commit is contained in:
Brett Cannon 2016-06-24 12:03:43 -07:00
parent 19b2a53a82
commit c78ca1e044
7 changed files with 101 additions and 71 deletions

View file

@ -879,7 +879,7 @@ class IOTest(unittest.TestCase):
check_path_succeeds(PathLike(support.TESTFN.encode('utf-8')))
bad_path = PathLike(TypeError)
with self.assertRaisesRegex(TypeError, 'invalid file'):
with self.assertRaises(TypeError):
self.open(bad_path, 'w')
# ensure that refcounting is correct with some error conditions