| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  | # | 
					
						
							|  |  |  | # test_codecencodings_kr.py | 
					
						
							|  |  |  | #   Codec encoding tests for ROK 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 Test_CP949(multibytecodec_support.TestBase, unittest.TestCase): | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     encoding = 'cp949' | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  |     tstring = multibytecodec_support.load_teststring('cp949') | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     codectests = ( | 
					
						
							|  |  |  |         # invalid bytes | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "strict",  None), | 
					
						
							|  |  |  |         (b"abc\xc8", "strict",  None), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\uc894"), | 
					
						
							|  |  |  |         (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\uc894"), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class Test_EUCKR(multibytecodec_support.TestBase, unittest.TestCase): | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     encoding = 'euc_kr' | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  |     tstring = multibytecodec_support.load_teststring('euc_kr') | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     codectests = ( | 
					
						
							|  |  |  |         # invalid bytes | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "strict",  None), | 
					
						
							|  |  |  |         (b"abc\xc8", "strict",  None), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "replace", 'abc\ufffd\ufffd\uc894'), | 
					
						
							|  |  |  |         (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\uc894"), | 
					
						
							| 
									
										
										
										
											2007-08-20 19:06:03 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # composed make-up sequence errors | 
					
						
							|  |  |  |         (b"\xa4\xd4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "strict", "\uc4d4"), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4x", "strict", "\uc4d4x"), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"a\xa4\xd4\xa4\xb6\xa4", "replace", 'a\ufffd'), | 
					
						
							| 
									
										
										
										
											2007-08-20 19:06:03 +00:00
										 |  |  |         (b"\xa4\xd4\xa3\xb6\xa4\xd0\xa4\xd4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa3\xd0\xa4\xd4", "strict", None), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa3\xd4", "strict", None), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", '\ufffd\u6e21\ufffd\u3160\ufffd'), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", '\ufffd\u6e21\ub544\ufffd\ufffd'), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", '\ufffd\u6e21\ub544\u572d\ufffd'), | 
					
						
							|  |  |  |         (b"\xa4\xd4\xff\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "replace", '\ufffd\ufffd\ufffd\uc4d4'), | 
					
						
							| 
									
										
										
										
											2007-08-20 19:06:03 +00:00
										 |  |  |         (b"\xc1\xc4", "strict", "\uc894"), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  | class Test_JOHAB(multibytecodec_support.TestBase, unittest.TestCase): | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     encoding = 'johab' | 
					
						
							| 
									
										
										
										
											2012-04-09 09:37:52 -04:00
										 |  |  |     tstring = multibytecodec_support.load_teststring('johab') | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     codectests = ( | 
					
						
							|  |  |  |         # invalid bytes | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "strict",  None), | 
					
						
							|  |  |  |         (b"abc\xc8", "strict",  None), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\ucd27"), | 
					
						
							|  |  |  |         (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\ucd27\ufffd"), | 
					
						
							| 
									
										
										
										
											2007-05-17 23:59:11 +00:00
										 |  |  |         (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\ucd27"), | 
					
						
							| 
									
										
										
										
											2011-07-08 01:45:13 +02:00
										 |  |  |         (b"\xD8abc", "replace",  "\uFFFDabc"), | 
					
						
							|  |  |  |         (b"\xD8\xFFabc", "replace",  "\uFFFD\uFFFDabc"), | 
					
						
							|  |  |  |         (b"\x84bxy", "replace",  "\uFFFDbxy"), | 
					
						
							|  |  |  |         (b"\x8CBxy", "replace",  "\uFFFDBxy"), | 
					
						
							| 
									
										
										
										
											2004-01-17 14:29:29 +00:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if __name__ == "__main__": | 
					
						
							| 
									
										
										
										
											2015-04-13 15:00:43 -05:00
										 |  |  |     unittest.main() |