summaryrefslogtreecommitdiff
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-06-25 10:56:11 +0000
committerEzio Melotti <ezio.melotti@gmail.com>2010-06-25 10:56:11 +0000
commitc6f5f74f4aefb378611274d3463e3b62f756b9d9 (patch)
tree354ad8117f8c0cdb7d7705668970c574f83ecb4d /Lib/test/test_genericpath.py
parentd9f8e54fb623721aecb3a6fe24d401d0c82d6cb3 (diff)
downloadcpython-c6f5f74f4aefb378611274d3463e3b62f756b9d9.tar.gz
#9018: os.path.normcase() now raises a TypeError if the argument is not str or bytes.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 9a0f2267f3..2955f49469 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -194,14 +194,18 @@ class CommonTest(GenericTest):
]
def test_normcase(self):
- # Check that normcase() is idempotent
- p = "FoO/./BaR"
- p = self.pathmodule.normcase(p)
- self.assertEqual(p, self.pathmodule.normcase(p))
-
- p = b"FoO/./BaR"
- p = self.pathmodule.normcase(p)
- self.assertEqual(p, self.pathmodule.normcase(p))
+ normcase = self.pathmodule.normcase
+ # check that normcase() is idempotent
+ for p in ["FoO/./BaR", b"FoO/./BaR"]:
+ p = normcase(p)
+ self.assertEqual(p, normcase(p))
+
+ self.assertEqual(normcase(''), '')
+ self.assertEqual(normcase(b''), b'')
+
+ # check that normcase raises a TypeError for invalid types
+ for path in (None, True, 0, 2.5, [], bytearray(b''), {'o','o'}):
+ self.assertRaises(TypeError, normcase, path)
def test_splitdrive(self):
# splitdrive for non-NT paths