def _utf8_width_le(width, *args): '''**Deprecated** Convert the arguments to unicode and use :func:`kitchen.text.display._textual_width_le` instead. ''' warnings.warn('kitchen.text.utf8._utf8_width_le is deprecated. Use' ' kitchen.text.display._textual_width_le instead', DeprecationWarning, stacklevel=2) # This assumes that all args. are utf8. return _textual_width_le(width, to_unicode(''.join(args)))
def test_internal_textual_width_le(self): test_data = ''.join([self.u_mixed, self.u_spanish]) tw = display.textual_width(test_data) tools.eq_(display._textual_width_le(68, self.u_mixed, self.u_spanish), (tw <= 68)) tools.eq_(display._textual_width_le(69, self.u_mixed, self.u_spanish), (tw <= 69)) tools.eq_(display._textual_width_le(137, self.u_mixed, self.u_spanish), (tw <= 137)) tools.eq_(display._textual_width_le(138, self.u_mixed, self.u_spanish), (tw <= 138)) tools.eq_(display._textual_width_le(78, self.u_mixed, self.u_spanish), (tw <= 78)) tools.eq_(display._textual_width_le(79, self.u_mixed, self.u_spanish), (tw <= 79))