summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-10-03 18:38:26 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-10-03 18:38:26 (GMT)
commitc72ef8b6dfbd73dee01c70fccc2d3cfe73fb9c56 (patch)
tree01483ca1b791ee8ec1a57fad4d9c30e924ac9183 /Lib/test
parent3f2291f8025cf01ac96981d4e3a5284ba6e57f9f (diff)
downloadcpython-c72ef8b6dfbd73dee01c70fccc2d3cfe73fb9c56.zip
cpython-c72ef8b6dfbd73dee01c70fccc2d3cfe73fb9c56.tar.gz
cpython-c72ef8b6dfbd73dee01c70fccc2d3cfe73fb9c56.tar.bz2
Second part of #3187, for windows:
os and os.path functions now accept both unicode and byte strings for file names. Reviewed by Guido.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ntpath.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index fa40db8..3dc7765 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -12,6 +12,23 @@ def tester(fn, wantResult):
raise TestFailed("%s should return: %s but returned: %s" \
%(str(fn), str(wantResult), str(gotResult)))
+ # then with bytes
+ fn = fn.replace("('", "(b'")
+ fn = fn.replace('("', '(b"')
+ fn = fn.replace("['", "[b'")
+ fn = fn.replace('["', '[b"')
+ fn = fn.replace(", '", ", b'")
+ fn = fn.replace(', "', ', b"')
+ gotResult = eval(fn)
+ if isinstance(wantResult, str):
+ wantResult = wantResult.encode('ascii')
+ elif isinstance(wantResult, tuple):
+ wantResult = tuple(r.encode('ascii') for r in wantResult)
+
+ gotResult = eval(fn)
+ if wantResult != gotResult:
+ raise TestFailed("%s should return: %s but returned: %s" \
+ %(str(fn), str(wantResult), repr(gotResult)))
class TestNtpath(unittest.TestCase):
def test_splitext(self):