Skip to content

Commit 94237df

Browse files
authored
Merge pull request #4587 from youknowone/crlf
Fix CR/LF of python libraries
2 parents 351d464 + 6ee827b commit 94237df

11 files changed

+9035
-9035
lines changed

Lib/test/test_bigmem.py

+1,291-1,291
Large diffs are not rendered by default.

Lib/test/test_buffer.py

+4,424-4,424
Large diffs are not rendered by default.

Lib/test/test_cgitb.py

+68-68
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
from test.support.os_helper import temp_dir
2-
from test.support.script_helper import assert_python_failure
3-
import unittest
4-
import sys
5-
import cgitb
6-
7-
class TestCgitb(unittest.TestCase):
8-
9-
def test_fonts(self):
10-
text = "Hello Robbie!"
11-
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(text))
12-
self.assertEqual(cgitb.strong(text), "<strong>{}</strong>".format(text))
13-
self.assertEqual(cgitb.grey(text),
14-
'<font color="#909090">{}</font>'.format(text))
15-
16-
def test_blanks(self):
17-
self.assertEqual(cgitb.small(""), "")
18-
self.assertEqual(cgitb.strong(""), "")
19-
self.assertEqual(cgitb.grey(""), "")
20-
21-
def test_html(self):
22-
try:
23-
raise ValueError("Hello World")
24-
except ValueError as err:
25-
# If the html was templated we could do a bit more here.
26-
# At least check that we get details on what we just raised.
27-
html = cgitb.html(sys.exc_info())
28-
self.assertIn("ValueError", html)
29-
self.assertIn(str(err), html)
30-
31-
def test_text(self):
32-
try:
33-
raise ValueError("Hello World")
34-
except ValueError as err:
35-
text = cgitb.text(sys.exc_info())
36-
self.assertIn("ValueError", text)
37-
self.assertIn("Hello World", text)
38-
39-
def test_syshook_no_logdir_default_format(self):
40-
with temp_dir() as tracedir:
41-
rc, out, err = assert_python_failure(
42-
'-c',
43-
('import cgitb; cgitb.enable(logdir=%s); '
44-
'raise ValueError("Hello World")') % repr(tracedir))
45-
out = out.decode(sys.getfilesystemencoding())
46-
self.assertIn("ValueError", out)
47-
self.assertIn("Hello World", out)
48-
self.assertIn("<strong>&lt;module&gt;</strong>", out)
49-
# By default we emit HTML markup.
50-
self.assertIn('<p>', out)
51-
self.assertIn('</p>', out)
52-
53-
def test_syshook_no_logdir_text_format(self):
54-
# Issue 12890: we were emitting the <p> tag in text mode.
55-
with temp_dir() as tracedir:
56-
rc, out, err = assert_python_failure(
57-
'-c',
58-
('import cgitb; cgitb.enable(format="text", logdir=%s); '
59-
'raise ValueError("Hello World")') % repr(tracedir))
60-
out = out.decode(sys.getfilesystemencoding())
61-
self.assertIn("ValueError", out)
62-
self.assertIn("Hello World", out)
63-
self.assertNotIn('<p>', out)
64-
self.assertNotIn('</p>', out)
65-
66-
67-
if __name__ == "__main__":
68-
unittest.main()
1+
from test.support.os_helper import temp_dir
2+
from test.support.script_helper import assert_python_failure
3+
import unittest
4+
import sys
5+
import cgitb
6+
7+
class TestCgitb(unittest.TestCase):
8+
9+
def test_fonts(self):
10+
text = "Hello Robbie!"
11+
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(text))
12+
self.assertEqual(cgitb.strong(text), "<strong>{}</strong>".format(text))
13+
self.assertEqual(cgitb.grey(text),
14+
'<font color="#909090">{}</font>'.format(text))
15+
16+
def test_blanks(self):
17+
self.assertEqual(cgitb.small(""), "")
18+
self.assertEqual(cgitb.strong(""), "")
19+
self.assertEqual(cgitb.grey(""), "")
20+
21+
def test_html(self):
22+
try:
23+
raise ValueError("Hello World")
24+
except ValueError as err:
25+
# If the html was templated we could do a bit more here.
26+
# At least check that we get details on what we just raised.
27+
html = cgitb.html(sys.exc_info())
28+
self.assertIn("ValueError", html)
29+
self.assertIn(str(err), html)
30+
31+
def test_text(self):
32+
try:
33+
raise ValueError("Hello World")
34+
except ValueError as err:
35+
text = cgitb.text(sys.exc_info())
36+
self.assertIn("ValueError", text)
37+
self.assertIn("Hello World", text)
38+
39+
def test_syshook_no_logdir_default_format(self):
40+
with temp_dir() as tracedir:
41+
rc, out, err = assert_python_failure(
42+
'-c',
43+
('import cgitb; cgitb.enable(logdir=%s); '
44+
'raise ValueError("Hello World")') % repr(tracedir))
45+
out = out.decode(sys.getfilesystemencoding())
46+
self.assertIn("ValueError", out)
47+
self.assertIn("Hello World", out)
48+
self.assertIn("<strong>&lt;module&gt;</strong>", out)
49+
# By default we emit HTML markup.
50+
self.assertIn('<p>', out)
51+
self.assertIn('</p>', out)
52+
53+
def test_syshook_no_logdir_text_format(self):
54+
# Issue 12890: we were emitting the <p> tag in text mode.
55+
with temp_dir() as tracedir:
56+
rc, out, err = assert_python_failure(
57+
'-c',
58+
('import cgitb; cgitb.enable(format="text", logdir=%s); '
59+
'raise ValueError("Hello World")') % repr(tracedir))
60+
out = out.decode(sys.getfilesystemencoding())
61+
self.assertIn("ValueError", out)
62+
self.assertIn("Hello World", out)
63+
self.assertNotIn('<p>', out)
64+
self.assertNotIn('</p>', out)
65+
66+
67+
if __name__ == "__main__":
68+
unittest.main()

0 commit comments

Comments
 (0)