diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-06-02 22:06:09 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-06-02 22:06:09 (GMT) |
commit | cdc0879d3a550ee7f339d149c451e2ebee1906f9 (patch) | |
tree | d2ee559bac76d8fae019310c2d5c96d0260fc24c /Lib/test/test_os.py | |
parent | 1f56e5f6afa137300d655a40e00675195e0248fe (diff) | |
download | cpython-cdc0879d3a550ee7f339d149c451e2ebee1906f9.zip cpython-cdc0879d3a550ee7f339d149c451e2ebee1906f9.tar.gz cpython-cdc0879d3a550ee7f339d149c451e2ebee1906f9.tar.bz2 |
issue27186 -- initial docs, tests, and python version of os.fspath
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 01404ff..f52de28 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3095,5 +3095,26 @@ class TestScandir(unittest.TestCase): del iterator +class TestPEP519(unittest.TestCase): + "os.fspath()" + + def test_return_bytes(self): + for b in b'hello', b'goodbye', b'some/path/and/file': + self.assertEqual(b, os.fspath(b)) + + def test_return_string(self): + for s in 'hello', 'goodbye', 'some/path/and/file': + self.assertEqual(s, os.fspath(s)) + + def test_garbage_in_exception_out(self): + vapor = type('blah', (), {}) + for o in int, type, os, vapor(): + self.assertRaises(TypeError, os.fspath, o) + + def test_argument_required(self): + with self.assertRaises(TypeError): + os.fspath() + + if __name__ == "__main__": unittest.main() |