[issue3446] center, ljust and rjust are inconsistent with unicode parameters

Ignas Mikalajūnas report at bugs.python.org
Fri Jul 25 17:59:23 CEST 2008


New submission from Ignas Mikalajūnas <ignas at pov.lt>:

Not all combinations of unicode/non-unicode parameters work for ljust,
center and rjust. Passing a unicode character to them as a parameter
when the string is ascii fails with an error.

This doctest fails in 3 places. Though I would expect it to be passing.

def doctest_strings():
    """

      >>> uni = u"a"
      >>> ascii = "a"

      >>> uni.center(5, ascii)
      u'aaaaa'

      >>> uni.center(5, uni)
      u'aaaaa'

      >>> ascii.center(5, ascii)
      'aaaaa'

      >>> ascii.center(5, uni)
      u'aaaaa'

      >>> uni.ljust(5, ascii)
      u'aaaaa'

      >>> uni.ljust(5, uni)
      u'aaaaa'

      >>> ascii.ljust(5, ascii)
      'aaaaa'

      >>> ascii.ljust(5, uni)
      u'aaaaa'

      >>> uni.rjust(5, ascii)
      u'aaaaa'

      >>> uni.rjust(5, uni)
      u'aaaaa'

      >>> ascii.rjust(5, ascii)
      'aaaaa'

      >>> ascii.rjust(5, uni)
      u'aaaaa'

    """

----------
components: Library (Lib), Unicode
messages: 70258
nosy: ignas
severity: normal
status: open
title: center, ljust and rjust are inconsistent with unicode parameters
type: behavior
versions: Python 2.4, Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3446>
_______________________________________


More information about the Python-bugs-list mailing list