diff --git tests/regressiontests/views/tests/debug.py tests/regressiontests/views/tests/debug.py
index e8a7d49..cc99c00 100644
|
|
from __future__ import absolute_import
|
3 | 3 | import inspect |
4 | 4 | import os |
5 | 5 | import sys |
| 6 | import tempfile |
6 | 7 | |
7 | 8 | from django.conf import settings |
8 | 9 | from django.core.files.uploadedfile import SimpleUploadedFile |
… |
… |
class ExceptionReporterTests(TestCase):
|
169 | 170 | self.assertNotIn('<h2>Traceback ', html) |
170 | 171 | self.assertIn('<h2>Request information</h2>', html) |
171 | 172 | self.assertIn('<p>Request data not supplied</p>', html) |
172 | | |
| 173 | |
| 174 | def test_eol_support(self): |
| 175 | """Test that the ExceptionReporter supports Unix, Windows and Macintosh EOL markers""" |
| 176 | LINES = list(u'print %d' % i for i in range(1,6)) |
| 177 | reporter = ExceptionReporter(None, None, None, None) |
| 178 | |
| 179 | for newline in ['\n','\r\n','\r']: |
| 180 | fd,filename = tempfile.mkstemp(text = False) |
| 181 | os.write(fd, newline.join(LINES)+newline) |
| 182 | os.close(fd) |
| 183 | |
| 184 | try: |
| 185 | self.assertEqual(reporter._get_lines_from_file(filename, 3, 2), (1, LINES[1:3], LINES[3], LINES[4:])) |
| 186 | finally: |
| 187 | os.unlink(filename) |
173 | 188 | |
174 | 189 | class PlainTextReportTests(TestCase): |
175 | 190 | rf = RequestFactory() |