| 
									
										
											  
											
												Merged revisions 69576,69579-69580,69589,69619-69620,69633,69703-69704,69728-69730 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r69576 | georg.brandl | 2009-02-13 04:56:50 -0600 (Fri, 13 Feb 2009) | 1 line
  #1661108: note that urlsafe encoded string can contain "=".
........
  r69579 | georg.brandl | 2009-02-13 05:06:59 -0600 (Fri, 13 Feb 2009) | 2 lines
  Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
  r69580 | georg.brandl | 2009-02-13 05:10:04 -0600 (Fri, 13 Feb 2009) | 2 lines
  Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
  r69589 | martin.v.loewis | 2009-02-13 14:11:34 -0600 (Fri, 13 Feb 2009) | 2 lines
  Move amd64 properties further to the top, so that they override
  the linker options correctly.
........
  r69619 | benjamin.peterson | 2009-02-14 11:00:51 -0600 (Sat, 14 Feb 2009) | 1 line
  this needn't be a shebang line
........
  r69620 | georg.brandl | 2009-02-14 11:01:36 -0600 (Sat, 14 Feb 2009) | 1 line
  #5179: don't leak PIPE fds when child execution fails.
........
  r69633 | hirokazu.yamamoto | 2009-02-15 03:19:48 -0600 (Sun, 15 Feb 2009) | 1 line
  Fixed typo.
........
  r69703 | raymond.hettinger | 2009-02-16 16:42:54 -0600 (Mon, 16 Feb 2009) | 3 lines
  Issue 5229: Documentation for super() neglects to say what super() actually does
........
  r69704 | raymond.hettinger | 2009-02-16 17:00:25 -0600 (Mon, 16 Feb 2009) | 1 line
  Add explanation for super(type1, type2).
........
  r69728 | georg.brandl | 2009-02-17 18:22:55 -0600 (Tue, 17 Feb 2009) | 2 lines
  #5297: fix example.
........
  r69729 | georg.brandl | 2009-02-17 18:25:13 -0600 (Tue, 17 Feb 2009) | 2 lines
  #5296: sequence -> iterable.
........
  r69730 | georg.brandl | 2009-02-17 18:31:36 -0600 (Tue, 17 Feb 2009) | 2 lines
  #5268: mention VMSError.
........
											
										 
											2009-02-19 04:22:03 +00:00
										 |  |  |  | # -*- coding: koi8-r -*- | 
					
						
							| 
									
										
										
										
											2009-02-14 17:00:16 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | import unittest | 
					
						
							|  |  |  |  | from test import support | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class PEP263Test(unittest.TestCase): | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     def test_pep263(self): | 
					
						
							|  |  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |  |             "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".encode("utf-8"), | 
					
						
							|  |  |  |  |             b'\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd' | 
					
						
							|  |  |  |  |         ) | 
					
						
							|  |  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |  |             "\<EFBFBD>".encode("utf-8"), | 
					
						
							|  |  |  |  |             b'\\\xd0\x9f' | 
					
						
							|  |  |  |  |         ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     def test_compilestring(self): | 
					
						
							|  |  |  |  |         # see #1882 | 
					
						
							|  |  |  |  |         c = compile(b"\n# coding: utf-8\nu = '\xc3\xb3'\n", "dummy", "exec") | 
					
						
							|  |  |  |  |         d = {} | 
					
						
							|  |  |  |  |         exec(c, d) | 
					
						
							|  |  |  |  |         self.assertEqual(d['u'], '\xf3') | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     def test_issue2301(self): | 
					
						
							|  |  |  |  |         try: | 
					
						
							|  |  |  |  |             compile(b"# coding: cp932\nprint '\x94\x4e'", "dummy", "exec") | 
					
						
							|  |  |  |  |         except SyntaxError as v: | 
					
						
							| 
									
										
										
										
											2009-11-13 00:17:59 +00:00
										 |  |  |  |             self.assertEquals(v.text, "print '\u5e74'\n") | 
					
						
							| 
									
										
										
										
											2009-02-14 17:00:16 +00:00
										 |  |  |  |         else: | 
					
						
							|  |  |  |  |             self.fail() | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-02 23:31:26 +00:00
										 |  |  |  |     def test_issue4626(self): | 
					
						
							|  |  |  |  |         c = compile("# coding=latin-1\n\u00c6 = '\u00c6'", "dummy", "exec") | 
					
						
							|  |  |  |  |         d = {} | 
					
						
							|  |  |  |  |         exec(c, d) | 
					
						
							|  |  |  |  |         self.assertEquals(d['\xc6'], '\xc6') | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-28 21:59:39 +00:00
										 |  |  |  |     def test_issue3297(self): | 
					
						
							|  |  |  |  |         c = compile("a, b = '\U0001010F', '\\U0001010F'", "dummy", "exec") | 
					
						
							|  |  |  |  |         d = {} | 
					
						
							|  |  |  |  |         exec(c, d) | 
					
						
							|  |  |  |  |         self.assertEqual(d['a'], d['b']) | 
					
						
							|  |  |  |  |         self.assertEqual(len(d['a']), len(d['b'])) | 
					
						
							|  |  |  |  |         self.assertEqual(ascii(d['a']), ascii(d['b'])) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-03 00:18:49 +00:00
										 |  |  |  |     def test_issue7820(self): | 
					
						
							|  |  |  |  |         # Ensure that check_bom() restores all bytes in the right order if | 
					
						
							|  |  |  |  |         # check_bom() fails in pydebug mode: a buffer starts with the first | 
					
						
							|  |  |  |  |         # byte of a valid BOM, but next bytes are different | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         # one byte in common with the UTF-16-LE BOM | 
					
						
							|  |  |  |  |         self.assertRaises(SyntaxError, eval, b'\xff\x20') | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         # two bytes in common with the UTF-8 BOM | 
					
						
							|  |  |  |  |         self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20') | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-14 17:00:16 +00:00
										 |  |  |  | def test_main(): | 
					
						
							|  |  |  |  |     support.run_unittest(PEP263Test) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | if __name__=="__main__": | 
					
						
							|  |  |  |  |     test_main() |