t90_bigauto.py (recode-3.7.4) | : | t90_bigauto.py (recode-3.7.5) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
the study is limited to those recodings having any of the given charsets | the study is limited to those recodings having any of the given charsets | |||
both as a starting and ending points. If there is no such non-option | both as a starting and ending points. If there is no such non-option | |||
argument, all possible possible recodings are considered. | argument, all possible possible recodings are considered. | |||
""" | """ | |||
import os, sys | import os, sys | |||
from common import py, Recode | from common import py, Recode | |||
from common import setup_module, teardown_module | from common import setup_module, teardown_module | |||
class Test: | class Test: | |||
avoid_as_before = 'count-characters', 'dump-with-names', 'flat' | avoid_as_before = b'count-characters', b'dump-with-names', b'flat' | |||
def test_1(self): | def test_1(self): | |||
if Recode is None: | if Recode is None: | |||
py.test.skip() | py.test.skip() | |||
self.outer = Recode.Outer(strict=False) | self.outer = Recode.Outer(strict=False) | |||
self.charsets = sorted(self.outer.all_charsets()) | self.charsets = sorted(self.outer.all_charsets()) | |||
for before in self.charsets: | for before in self.charsets: | |||
if before not in self.avoid_as_before: | if before not in self.avoid_as_before: | |||
yield self.validate, before | yield self.validate, before | |||
skipping to change at line 60 | skipping to change at line 60 | |||
self.charsets = sorted(self.outer.all_charsets()) | self.charsets = sorted(self.outer.all_charsets()) | |||
for before in self.charsets: | for before in self.charsets: | |||
if before not in self.avoid_as_before: | if before not in self.avoid_as_before: | |||
yield self.validate, before | yield self.validate, before | |||
def validate(self, before): | def validate(self, before): | |||
# As a compromise between being too terse or too verbose, we | # As a compromise between being too terse or too verbose, we | |||
# consider as a single test, one "before" against all "after"s. | # consider as a single test, one "before" against all "after"s. | |||
# However, without a Recode module, we do not know how many | # However, without a Recode module, we do not know how many | |||
# "before"s exist, and the skip count is then rather small. | # "before"s exist, and the skip count is then rather small. | |||
print before | print(before) | |||
for after in self.charsets: | for after in self.charsets: | |||
if after is not before: | if after is not before: | |||
request = Recode.Request(self.outer) | request = Recode.Request(self.outer) | |||
request.scan('%s..%s' % (before, after)) | request.scan(b'%s..%s' % (before, after)) | |||
def main(*arguments): | def main(*arguments): | |||
recode_options = [] | recode_options = [] | |||
charset_options = [] | charset_options = [] | |||
for argument in arguments: | for argument in arguments: | |||
if arguments[0] == '-': | if arguments[0] == '-': | |||
recode_options.append(argument) | recode_options.append(argument) | |||
else: | else: | |||
charset_options.append(argument) | charset_options.append(argument) | |||
report = Report() | report = Report() | |||
skipping to change at line 100 | skipping to change at line 100 | |||
lensep = len(os.linesep) | lensep = len(os.linesep) | |||
line = readline() | line = readline() | |||
while line: | while line: | |||
type, request = line[:-lensep].split(':', 1) | type, request = line[:-lensep].split(':', 1) | |||
if type == 'Request': | if type == 'Request': | |||
steps = self.get_steps(request) | steps = self.get_steps(request) | |||
self.count_original_request(steps, request) | self.count_original_request(steps, request) | |||
line = readline() | line = readline() | |||
if line: | if line: | |||
if len(line[:-lensep].split(':', 1)) != 2: | if len(line[:-lensep].split(':', 1)) != 2: | |||
print '*', line, | print('*', line, end='') | |||
type, shrunk_to = line[:-lensep].split(':', 1) | type, shrunk_to = line[:-lensep].split(':', 1) | |||
if type == 'Shrunk to': | if type == 'Shrunk to': | |||
steps = self.get_steps(shrunk_to) | steps = self.get_steps(shrunk_to) | |||
self.count_shrunk_request(steps, shrunk_to) | self.count_shrunk_request(steps, shrunk_to) | |||
line = readline() | line = readline() | |||
else: | else: | |||
self.count_shrunk_request(steps, request) | self.count_shrunk_request(steps, request) | |||
else: | else: | |||
self.count_shrunk_request(steps, request) | self.count_shrunk_request(steps, request) | |||
else: | else: | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |