diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-26 15:31:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-26 15:31:12 (GMT) |
commit | 689830ee6243126798a6c519c05aa11ba73db7cd (patch) | |
tree | 165d26fd54d4853988429c3731234cba84c6ce68 /Lib/test/test_os.py | |
parent | c6a2320e876354ee62cf8149b849bcff9492d38a (diff) | |
download | cpython-689830ee6243126798a6c519c05aa11ba73db7cd.zip cpython-689830ee6243126798a6c519c05aa11ba73db7cd.tar.gz cpython-689830ee6243126798a6c519c05aa11ba73db7cd.tar.bz2 |
bpo-37412: os.getcwdb() now uses UTF-8 on Windows (GH-14396)
The os.getcwdb() function now uses the UTF-8 encoding on Windows,
rather than the ANSI code page: see PEP 529 for the rationale. The
function is no longer deprecated on Windows.
os.getcwd() and os.getcwdb() now detect integer overflow on memory
allocations. On Unix, these functions properly report MemoryError on
memory allocation failure.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 527f814..18cd78b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -82,6 +82,17 @@ def create_file(filename, content=b'content'): fp.write(content) +class MiscTests(unittest.TestCase): + def test_getcwd(self): + cwd = os.getcwd() + self.assertIsInstance(cwd, str) + + def test_getcwdb(self): + cwd = os.getcwdb() + self.assertIsInstance(cwd, bytes) + self.assertEqual(os.fsdecode(cwd), os.getcwd()) + + # Tests creating TESTFN class FileTests(unittest.TestCase): def setUp(self): |