| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | # | 
					
						
							|  |  |  | # test_codecmaps_jp.py | 
					
						
							|  |  |  | #   Codec mapping tests for Japanese encodings | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | from test import multibytecodec_support | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | import unittest | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class TestCP932Map(multibytecodec_support.TestBase_Mapping, | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |                    unittest.TestCase): | 
					
						
							|  |  |  |     encoding = 'cp932' | 
					
						
							| 
									
										
										
										
											2014-11-06 14:37:49 +01:00
										 |  |  |     mapfileurl = 'http://www.pythontest.net/unicode/CP932.TXT' | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     supmaps = [ | 
					
						
							| 
									
										
										
										
											2007-07-23 18:06:59 +00:00
										 |  |  |         (b'\x80', '\u0080'), | 
					
						
							|  |  |  |         (b'\xa0', '\uf8f0'), | 
					
						
							|  |  |  |         (b'\xfd', '\uf8f1'), | 
					
						
							|  |  |  |         (b'\xfe', '\uf8f2'), | 
					
						
							|  |  |  |         (b'\xff', '\uf8f3'), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ] | 
					
						
							|  |  |  |     for i in range(0xa1, 0xe0): | 
					
						
							| 
									
										
										
										
											2007-07-23 18:06:59 +00:00
										 |  |  |         supmaps.append((bytes([i]), chr(i+0xfec0))) | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class TestEUCJPCOMPATMap(multibytecodec_support.TestBase_Mapping, | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |                          unittest.TestCase): | 
					
						
							|  |  |  |     encoding = 'euc_jp' | 
					
						
							|  |  |  |     mapfilename = 'EUC-JP.TXT' | 
					
						
							| 
									
										
										
										
											2014-11-06 14:37:49 +01:00
										 |  |  |     mapfileurl = 'http://www.pythontest.net/unicode/EUC-JP.TXT' | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class TestSJISCOMPATMap(multibytecodec_support.TestBase_Mapping, | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |                         unittest.TestCase): | 
					
						
							|  |  |  |     encoding = 'shift_jis' | 
					
						
							|  |  |  |     mapfilename = 'SHIFTJIS.TXT' | 
					
						
							| 
									
										
										
										
											2014-11-06 14:37:49 +01:00
										 |  |  |     mapfileurl = 'http://www.pythontest.net/unicode/SHIFTJIS.TXT' | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     pass_enctest = [ | 
					
						
							| 
									
										
										
										
											2007-07-23 18:06:59 +00:00
										 |  |  |         (b'\x81_', '\\'), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ] | 
					
						
							|  |  |  |     pass_dectest = [ | 
					
						
							| 
									
										
										
										
											2007-07-23 18:06:59 +00:00
										 |  |  |         (b'\\', '\xa5'), | 
					
						
							|  |  |  |         (b'~', '\u203e'), | 
					
						
							|  |  |  |         (b'\x81_', '\\'), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class TestEUCJISX0213Map(multibytecodec_support.TestBase_Mapping, | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |                          unittest.TestCase): | 
					
						
							|  |  |  |     encoding = 'euc_jisx0213' | 
					
						
							|  |  |  |     mapfilename = 'EUC-JISX0213.TXT' | 
					
						
							| 
									
										
										
										
											2014-11-06 14:37:49 +01:00
										 |  |  |     mapfileurl = 'http://www.pythontest.net/unicode/EUC-JISX0213.TXT' | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class TestSJISX0213Map(multibytecodec_support.TestBase_Mapping, | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |                        unittest.TestCase): | 
					
						
							|  |  |  |     encoding = 'shift_jisx0213' | 
					
						
							|  |  |  |     mapfilename = 'SHIFT_JISX0213.TXT' | 
					
						
							| 
									
										
										
										
											2014-11-06 14:37:49 +01:00
										 |  |  |     mapfileurl = 'http://www.pythontest.net/unicode/SHIFT_JISX0213.TXT' | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if __name__ == "__main__": | 
					
						
							| 
									
										
										
										
											2014-07-01 19:55:04 -05:00
										 |  |  |     unittest.main() |