On Fri, Nov 27, 2009 at 10:18 AM, Florent Hivert <florent.hiv...@univ-rouen.fr> wrote: > Hi Jason ! > >> The patch is already done and waiting on trac for several months: >> >> http://trac.sagemath.org/sage_trac/ticket/1918 > > Excellent ! > >> You just have to update a bunch of doctests and review the patch! > > I was ready to do that, unfortunately, that not the problem here. There seems > to be some interference with the doctest mechanism: > > If you take a random test file, you'll see that the answer that is expected by > sage is printed on the screen before sage reports the error and that sage > reports that he get nothing. So it seems that the result of the patch is that > the doctest mechanism is bypassed and that the output goes directly to the > screen. I'll investigate this but I don't know anything neither about sage > output > mechanism not on sage doctest mechanism. So if anyone have a idea, please > help. >
It might be worth playing around with this code at the bottom of the patch: 181 @classmethod 182 def install(cls): 183 """ 184 Install a new displayhook, so that subsequent output from the interpreter 185 will be processed by this class. 186 """ 187 # First, try to install the hook using the IPython hook API. 188 ipapi = IPython.ipapi.get() 189 if ipapi: 190 # IPython's default result_display() uses the 191 # IPython.genutils.Term.cout stream. 192 dh = cls(IPython.genutils.Term.cout) 193 ipapi.set_hook('result_display', dh.result_display) 194 else: 195 # In certain modes where IPython is not in use, it is necessary to 196 # fall back to setting Python's sys.displayhook. 197 dh = cls(sys.stdout) 198 sys.displayhook = dh.displayhook Force one or other of the cases in that if statement. I don't have time to work on this right now. > Cheers, > > Florent > > > sage -t "devel/sage-combinat/sage/combinat/subword.py" > Subwords of ['a', 'b', 'c'] > ********************************************************************** > File "/usr/local/sage/sage-4.2/devel/sage-combinat/sage/combinat/subword.py", > line 66: > sage: S = Subwords(['a','b','c']); S > Expected: > Subwords of ['a', 'b', 'c'] > Got nothing > [] > ********************************************************************** > File "/usr/local/sage/sage-4.2/devel/sage-combinat/sage/combinat/subword.py", > line 68: > sage: S.first() > Expected: > [] > Got nothing > ['a', 'b', 'c'] > ********************************************************************** > File "/usr/local/sage/sage-4.2/devel/sage-combinat/sage/combinat/subword.py", > line 70: > sage: S.last() > Expected: > ['a', 'b', 'c'] > Got nothing > [[], ['a'], ['b'], ['c'], ['a', 'b'], ['a', 'c'], ['b', 'c'], ['a', 'b', 'c']] > ********************************************************************** > File "/usr/local/sage/sage-4.2/devel/sage-combinat/sage/combinat/subword.py", > line 72: > sage: S.list() > Expected: > [[], ['a'], ['b'], ['c'], ['a', 'b'], ['a', 'c'], ['b', 'c'], ['a', 'b', > 'c']] > Got nothing > Subwords of ['a', 'b', 'c'] of length 2 > ********************************************************************** > File "/usr/local/sage/sage-4.2/devel/sage-combinat/sage/combinat/subword.py", > line 77: > sage: S = Subwords(['a','b','c'], 2); S > Expected: > Subwords of ['a', 'b', 'c'] of length 2 > Got nothing > [['a', 'b'], ['a', 'c'], ['b', 'c']] > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org