Okay, nearly there. Two tests from textwrapper that use `fix_sentence_endings=True` fail because of this code in the textwrap module which puts bytestrings in the chunks list:
if chunks[i+1] == " " and pat.search(chunks[i]):
chunks[i+1] = " "
Resulting in errors like:
Traceback (most recent call last):
...
File "...\lib\test\test_textwrap.py", line 102, in test_fix_sentence_endings
self.check(wrapper.wrap(text), expect)
File "...\i18n-utextwrap\bzrlib\utextwrap.py", line 216, in wrap
return textwrap.TextWrapper.wrap(self, unicode(text))
File "...\lib\textwrap.py", line 321, in wrap
return self._wrap_chunks(chunks)
File "...\i18n-utextwrap\bzrlib\utextwrap.py", line 172, in _wrap_chunks
l = self._width(chunks[-1])
File "...\i18n-utextwrap\bzrlib\utextwrap.py", line 95, in _width
return sum(charwidth(c) for c in s)
File "...\i18n-utextwrap\bzrlib\utextwrap.py", line 95, in <genexpr>
return sum(charwidth(c) for c in s)
File "...\i18n-utextwrap\bzrlib\utextwrap.py", line 86, in _unicode_char_width
return (_eawidth(uc) in self._east_asian_doublewidth and 2) or 1
TypeError: must be unicode, not str
Annoying. That option is pretty bogus anyway, I'd not mind just not supporting it. Otherwise _fix_sentence_endings needs overriding so it doesn't mix up types in the chunks list.
Okay, nearly there. Two tests from textwrapper that use `fix_sentence_ endings= True` fail because of this code in the textwrap module which puts bytestrings in the chunks list:
if chunks[i+1] == " " and pat.search( chunks[ i]):
chunks[i+1] = " "
Resulting in errors like:
Traceback (most recent call last): test\test_ textwrap. py", line 102, in test_fix_ sentence_ endings check(wrapper. wrap(text) , expect) utextwrap\ bzrlib\ utextwrap. py", line 216, in wrap TextWrapper. wrap(self, unicode(text)) textwrap. py", line 321, in wrap chunks( chunks) utextwrap\ bzrlib\ utextwrap. py", line 172, in _wrap_chunks chunks[ -1]) utextwrap\ bzrlib\ utextwrap. py", line 95, in _width utextwrap\ bzrlib\ utextwrap. py", line 95, in <genexpr> utextwrap\ bzrlib\ utextwrap. py", line 86, in _unicode_char_width asian_doublewid th and 2) or 1
...
File "...\lib\
self.
File "...\i18n-
return textwrap.
File "...\lib\
return self._wrap_
File "...\i18n-
l = self._width(
File "...\i18n-
return sum(charwidth(c) for c in s)
File "...\i18n-
return sum(charwidth(c) for c in s)
File "...\i18n-
return (_eawidth(uc) in self._east_
TypeError: must be unicode, not str
Annoying. That option is pretty bogus anyway, I'd not mind just not supporting it. Otherwise _fix_sentence_ endings needs overriding so it doesn't mix up types in the chunks list.