[Python-checkins] cpython (3.5): Issue #13849: Add tests for null byte checking in test_genericpath
berker.peksag
python-checkins at python.org
Sat Jul 23 00:32:16 EDT 2016
https://hg.python.org/cpython/rev/899f06eb390c
changeset: 102426:899f06eb390c
branch: 3.5
parent: 102422:da955567d7c7
user: Berker Peksag <berker.peksag at gmail.com>
date: Sat Jul 23 07:31:47 2016 +0300
summary:
Issue #13849: Add tests for null byte checking in test_genericpath
files:
Lib/test/test_genericpath.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -274,6 +274,15 @@
# and is only meant to be inherited by others.
pathmodule = genericpath
+ def test_null_bytes(self):
+ for attr in GenericTest.common_attributes:
+ # os.path.commonprefix doesn't raise ValueError
+ if attr == 'commonprefix':
+ continue
+ with self.subTest(attr=attr):
+ with self.assertRaises(ValueError) as cm:
+ getattr(self.pathmodule, attr)('/tmp\x00abcds')
+ self.assertEqual(str(cm.exception), 'embedded null byte')
# Following TestCase is not supposed to be run from test_genericpath.
# It is inherited by other test modules (macpath, ntpath, posixpath).
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list