diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 21:26:31 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 21:26:31 (GMT) |
commit | e9b912164b9ef4b2cc4c350bcf4e212b2e9b3b73 (patch) | |
tree | 7a5418f065b1d7c07a396634b8d89145250bff3f /Lib/test | |
parent | 958980190cd04b819d592dd6654df72cd1df3edd (diff) | |
download | cpython-e9b912164b9ef4b2cc4c350bcf4e212b2e9b3b73.zip cpython-e9b912164b9ef4b2cc4c350bcf4e212b2e9b3b73.tar.gz cpython-e9b912164b9ef4b2cc4c350bcf4e212b2e9b3b73.tar.bz2 |
Merged revisions 71058,71149-71150,71212,71214-71216,71222,71225,71234,71237-71238,71240-71241,71243,71249,71251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71058 | georg.brandl | 2009-04-02 20:09:04 +0200 (Do, 02 Apr 2009) | 3 lines
PyErr_NormalizeException may not set an error, so convert the PyErr_SetObject
call on hitting the recursion limit into just assigning it to the arguments provided.
........
r71149 | georg.brandl | 2009-04-04 15:42:39 +0200 (Sa, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 15:45:49 +0200 (Sa, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71212 | georg.brandl | 2009-04-05 12:24:20 +0200 (So, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 12:29:57 +0200 (So, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 12:32:26 +0200 (So, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 12:41:02 +0200 (So, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71222 | georg.brandl | 2009-04-05 13:07:14 +0200 (So, 05 Apr 2009) | 1 line
#5615: make it possible to configure --without-threads again.
........
r71225 | georg.brandl | 2009-04-05 13:54:07 +0200 (So, 05 Apr 2009) | 1 line
#5580: no need to use parentheses when converterr() argument is actually a type description.
........
r71234 | georg.brandl | 2009-04-05 15:16:35 +0200 (So, 05 Apr 2009) | 1 line
Whitespace normalization.
........
r71237 | georg.brandl | 2009-04-05 16:24:52 +0200 (So, 05 Apr 2009) | 1 line
#1326077: fix traceback formatting of SyntaxErrors. This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space.
........
r71238 | georg.brandl | 2009-04-05 16:25:41 +0200 (So, 05 Apr 2009) | 1 line
Add NEWS entry for r71237.
........
r71240 | georg.brandl | 2009-04-05 16:40:06 +0200 (So, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
r71241 | georg.brandl | 2009-04-05 16:48:49 +0200 (So, 05 Apr 2009) | 1 line
#5471: fix expanduser() for $HOME set to "/".
........
r71243 | georg.brandl | 2009-04-05 17:14:29 +0200 (So, 05 Apr 2009) | 1 line
#5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
r71249 | georg.brandl | 2009-04-05 18:30:43 +0200 (So, 05 Apr 2009) | 1 line
#5444: adapt make.bat to new htmlhelp output file name.
........
r71251 | georg.brandl | 2009-04-05 19:17:42 +0200 (So, 05 Apr 2009) | 1 line
#5298: clarify docs about GIL by using more consistent wording.
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_posixpath.py | 5 | ||||
-rw-r--r-- | Lib/test/test_traceback.py | 29 |
2 files changed, 22 insertions, 12 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 46ac067..e6f750a 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -345,6 +345,11 @@ class PosixPathTest(unittest.TestCase): self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) + orig_home = os.environ['HOME'] + os.environ['HOME'] = '/' + self.assertEqual(posixpath.expanduser("~"), "/") + os.environ['HOME'] = orig_home + self.assertRaises(TypeError, posixpath.expanduser) def test_expandvars(self): diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 0708f81..5cd08ee 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -8,16 +8,6 @@ from test.test_support import run_unittest, is_jython, Error import traceback -try: - raise KeyError -except KeyError: - type_, value, tb = sys.exc_info() - file_ = StringIO() - traceback_print(tb, file_) - example_traceback = file_.getvalue() -else: - raise Error("unable to create test traceback string") - class TracebackCases(unittest.TestCase): # For now, a very minimal set of tests. I want to be sure that @@ -162,9 +152,24 @@ def test(): class TracebackFormatTests(unittest.TestCase): - def test_traceback_indentation(self): + def test_traceback_format(self): + try: + raise KeyError('blah') + except KeyError: + type_, value, tb = sys.exc_info() + traceback_fmt = 'Traceback (most recent call last):\n' + \ + ''.join(traceback.format_tb(tb)) + file_ = StringIO() + traceback_print(tb, file_) + python_fmt = file_.getvalue() + else: + raise Error("unable to create test traceback string") + + # Make sure that Python and the traceback module format the same thing + self.assertEquals(traceback_fmt, python_fmt) + # Make sure that the traceback is properly indented. - tb_lines = example_traceback.splitlines() + tb_lines = python_fmt.splitlines() self.assertEquals(len(tb_lines), 3) banner, location, source_line = tb_lines self.assert_(banner.startswith('Traceback')) |