예제 #1
0
파일: t80_error.py 프로젝트: shlomif/recode
 def test_1(
         self
 ):  # Ensure correct error code returned for untranslatable input
     request = Recode.Request(outer)
     request.scan('utf-8..latin1')
     task = Recode.Task(request)
     task.set_input("\303\241 \303\247  \316\261 \316\266")
     task.perform()
     assert (task.get_error() == Recode.UNTRANSLATABLE)
예제 #2
0
파일: t40_java.py 프로젝트: rrthomas/recode
 def test_2(self):
     # Block of lines from Java, without requiring BOM for each Unicode character.
     request = Recode.Request(outer)
     request.scan(b'java..l1/qp')
     task = Recode.Task(request)
     task.set_byte_order_mark(False)
     task.set_input(output)
     task.perform()
     task_output = task.get_output()
     assert_or_diff(task_output, input)
예제 #3
0
 def test_2(
     self
 ):  # Ensure correct error code returned for untranslatable input (with iconv)
     request = Recode.Request(outer_iconv)
     request.scan(b'utf-8..latin1')
     task = Recode.Task(request)
     task.set_input(b"\303\241 \303\247  \316\261 \316\266")
     task.set_abort_level(Recode.UNTRANSLATABLE)
     task.perform()
     assert (task.get_error() == Recode.UNTRANSLATABLE)
예제 #4
0
 def test_2(self):
     if Recode is None:
         py.test.skip()
     self.outer = Recode.Outer(strict=True)
     self.charsets = sorted(self.outer.all_charsets())
     for before in self.charsets:
         if before not in self.avoid_as_before:
             yield self.validate, before
예제 #5
0
 def validate(self, before):
     # As a compromise between being too terse or too verbose, we
     # consider as a single test, one "before" against all "after"s.
     # However, without a Recode module, we do not know how many
     # "before"s exist, and the skip count is then rather small.
     print(before)
     for after in self.charsets:
         if after is not before:
             request = Recode.Request(self.outer)
             request.scan(b'%s..%s' % (before, after))