Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Side by Side Diff: Lib/test/test_codecs.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_codecmaps_tw.py ('k') | Lib/test/test_compileall.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from test import support 1 from test import support
2 import unittest 2 import unittest
3 import codecs 3 import codecs
4 import locale
5 import sys, _testcapi, io 4 import sys, _testcapi, io
6 5
7 class Queue(object): 6 class Queue(object):
8 """ 7 """
9 queue: write bytes at one end, read bytes from the other end 8 queue: write bytes at one end, read bytes from the other end
10 """ 9 """
11 def __init__(self, buffer): 10 def __init__(self, buffer):
12 self._buffer = buffer 11 self._buffer = buffer
13 12
14 def write(self, chars): 13 def write(self, chars):
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 self.assertRaises(TypeError, codecs.getdecoder) 1222 self.assertRaises(TypeError, codecs.getdecoder)
1224 self.assertRaises(LookupError, codecs.getdecoder, "__spam__") 1223 self.assertRaises(LookupError, codecs.getdecoder, "__spam__")
1225 1224
1226 def test_getreader(self): 1225 def test_getreader(self):
1227 self.assertRaises(TypeError, codecs.getreader) 1226 self.assertRaises(TypeError, codecs.getreader)
1228 self.assertRaises(LookupError, codecs.getreader, "__spam__") 1227 self.assertRaises(LookupError, codecs.getreader, "__spam__")
1229 1228
1230 def test_getwriter(self): 1229 def test_getwriter(self):
1231 self.assertRaises(TypeError, codecs.getwriter) 1230 self.assertRaises(TypeError, codecs.getwriter)
1232 self.assertRaises(LookupError, codecs.getwriter, "__spam__") 1231 self.assertRaises(LookupError, codecs.getwriter, "__spam__")
1233
1234 def test_lookup_issue1813(self):
1235 # Issue #1813: under Turkish locales, lookup of some codecs failed
1236 # because 'I' is lowercased as "ı" (dotless i)
1237 oldlocale = locale.getlocale(locale.LC_CTYPE)
1238 self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
1239 try:
1240 locale.setlocale(locale.LC_CTYPE, 'tr_TR')
1241 except locale.Error:
1242 # Unsupported locale on this system
1243 self.skipTest('test needs Turkish locale')
1244 c = codecs.lookup('ASCII')
1245 self.assertEqual(c.name, 'ascii')
1246 1232
1247 class StreamReaderTest(unittest.TestCase): 1233 class StreamReaderTest(unittest.TestCase):
1248 1234
1249 def setUp(self): 1235 def setUp(self):
1250 self.reader = codecs.getreader('utf-8') 1236 self.reader = codecs.getreader('utf-8')
1251 self.stream = io.BytesIO(b'\xed\x95\x9c\n\xea\xb8\x80') 1237 self.stream = io.BytesIO(b'\xed\x95\x9c\n\xea\xb8\x80')
1252 1238
1253 def test_readlines(self): 1239 def test_readlines(self):
1254 f = self.reader(self.stream) 1240 f = self.reader(self.stream)
1255 self.assertEqual(f.readlines(), ['\ud55c\n', '\uae00']) 1241 self.assertEqual(f.readlines(), ['\ud55c\n', '\uae00'])
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 WithStmtTest, 1744 WithStmtTest,
1759 TypesTest, 1745 TypesTest,
1760 SurrogateEscapeTest, 1746 SurrogateEscapeTest,
1761 BomTest, 1747 BomTest,
1762 TransformCodecTest, 1748 TransformCodecTest,
1763 ) 1749 )
1764 1750
1765 1751
1766 if __name__ == "__main__": 1752 if __name__ == "__main__":
1767 test_main() 1753 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_codecmaps_tw.py ('k') | Lib/test/test_compileall.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+