diff options
author | Brett Cannon <bcannon@gmail.com> | 2003-04-28 21:30:13 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2003-04-28 21:30:13 (GMT) |
commit | 2b6dfec1cccee1d9aa91d986cebcaa5d651438c7 (patch) | |
tree | f951ba26284e546c16d791a33507165a87194927 /Lib/test/test_strptime.py | |
parent | a390c6e194a7a7787aa0dfee0ac6628e542add54 (diff) | |
download | cpython-2b6dfec1cccee1d9aa91d986cebcaa5d651438c7.zip cpython-2b6dfec1cccee1d9aa91d986cebcaa5d651438c7.tar.gz cpython-2b6dfec1cccee1d9aa91d986cebcaa5d651438c7.tar.bz2 |
Raise a ValueError when there is data that was not covered in the format string. Done to match behavior of pre-existing C-based strptime implementations.
Diffstat (limited to 'Lib/test/test_strptime.py')
-rw-r--r-- | Lib/test/test_strptime.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index a106a42..2c3955b 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -227,6 +227,10 @@ class StrptimeTests(unittest.TestCase): self.assertRaises(ValueError, _strptime.strptime, data_string="%d", format="%A") + def test_unconverteddata(self): + # Check ValueError is raised when there is unconverted data + self.assertRaises(ValueError, _strptime.strptime, "10 12", "%m") + def helper(self, directive, position): """Helper fxn in testing.""" strf_output = time.strftime("%" + directive, self.time_tuple) |