Skip to content

Commit

Permalink
Trac #28644: unicode art fails for empty skew partition
Browse files Browse the repository at this point in the history
{{{
sage: unicode_art(SkewPartition([[],[]]))
------------------------------------------------------------------------
---
IndexError                                Traceback (most recent call
last)
<ipython-input-75-4f053427a9a8> in <module>()
----> 1 unicode_art(SkewPartition([[],[]]))

/home/martin/sage-develop/local/lib/python2.7/site-
packages/sage/misc/lazy_import.pyx in
sage.misc.lazy_import.LazyImport.__call__
(build/cythonized/sage/misc/lazy_import.c:3697)()
    352             True
    353         """
--> 354         return self.get_object()(*args, **kwds)
    355
    356     def __repr__(self):

/home/martin/sage-develop/local/lib/python2.7/site-
packages/sage/typeset/unicode_art.pyc in unicode_art(*obj, **kwds)
    149         raise ValueError('unknown keyword arguments:
{0}'.format(list(kwds)))
    150     if len(obj) == 1:
--> 151         return _unicode_art_factory.build(obj[0],
baseline=baseline)
    152     if not isinstance(separator, UnicodeArt):
    153         separator = _unicode_art_factory.build(separator,
baseline=sep_baseline)

/home/martin/sage-develop/local/lib/python2.7/site-
packages/sage/typeset/character_art_factory.pyc in build(self, obj,
baseline)
    120             return obj
    121         if isinstance(obj, SageObject):
--> 122             return self.build_from_magic_method(obj, baseline)
    123         if baseline is None:
    124             baseline = 0

/home/martin/sage-develop/local/lib/python2.7/site-
packages/sage/typeset/character_art_factory.pyc in
build_from_magic_method(self, obj, baseline)
    168         """
    169         magic_method = getattr(obj, self.magic_method_name)
--> 170         ret = magic_method()
    171         if baseline is not None:
    172             ret._baseline = baseline

/home/martin/sage-develop/local/lib/python2.7/site-
packages/sage/combinat/skew_partition.pyc in _unicode_art_(self)
    466
    467         # working with English conventions
--> 468         txt = [s * inn[0] + tl + t * (out[0] - inn[0] - 1) + tr]
    469         for i in range(len(out) - 1):
    470             o0 = out[i]

IndexError: list index out of range
}}}

URL: https://trac.sagemath.org/28644
Reported by: mantepse
Ticket author(s): Frédéric Chapoton
Reviewer(s): Martin Rubey
  • Loading branch information
Release Manager committed Oct 26, 2019
2 parents 9627de6 + 410d40b commit e7d08d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sage/combinat/skew_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,16 @@ def _unicode_art_(self):
┌┐
┌┬┴┘
└┘
TESTS::
sage: unicode_art(SkewPartition([[],[]]))
"""
from sage.typeset.unicode_art import UnicodeArt
out, inn = self
inn = inn + [0] * (len(out) - len(inn))
if not self._list:
if not any(self._list):
return UnicodeArt(u'∅')
if self.parent().options.convention == "French":
s, t, b, l, r, tr, tl, br, bl, x, h = list(u' ┴┬├┤┘└┐┌┼─')
Expand Down

0 comments on commit e7d08d3

Please sign in to comment.