Thank you John for the improvement ! I will for sure change it. But there is still an unanswered question (I must admit I was not very clear). When I add the following string in my docstring
981 sage: for i in range(1,10): 982 sage: for j in range(1,10): 983 sage: if i != j: 984 sage: w = words.KolakoskiWord(alphabet=(i,j)) 985 sage: assert w[:50] == w.delta()[:50] and I run sage -t on the corresponding file, I get the following error. ********************************************************************** File "/Users/alexandre/Applications/sage/devel/sage-combinat/sage/ combinat/words/word_generators.py", line 985: sage: assert w[:50] == w.delta()[:50] Exception raised: Traceback (most recent call last): File "/Users/alexandre/Applications/sage/local/bin/ ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/Users/alexandre/Applications/sage/local/bin/ sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/Users/alexandre/Applications/sage/local/bin/ ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_18[12]>", line 1 assert w[:Integer(50)] == w.delta()[:Integer(50)]###line 985: sage: assert w[:50] == w.delta()[:50] ^ IndentationError: unexpected indent ********************************************************************** My indentation looks correct (four spaces and all aligned). I also tried by replacing all but the first 'sage' by '....' but it doesn't work either. Any idea what I may do wrong ? Thank you again ! Alex On 23 avr, 09:03, John Cremona <john.crem...@gmail.com> wrote: > Why don't you, instead of collecting all the booleans in a list, > assert each one? > > On 23 April 2010 13:55, ablondin <alexandre.blondin.ma...@gmail.com> wrote: > > > Hello, everyone ! > > What is the right syntax to include a test like this one in the > > docstring ? > > Delete this line: > > > sage: valid = [] > > Keep this: > > > sage: for i in range(1,10): > > sage: for j in range(1,10): > > sage: if i != j: > > sage: w = words.KolakoskiWord(alphabet=(i,j)) > > Replace these two > > > sage: valid.append(w[:50] == w.delta()[:50]) > > sage: all(valid) > > with > > sage: assert append(w[:50] == w.delta()[:50] > > There is no output if all is well; otherwise an AssertionError will be > raised. > > John > > > True > > > I can't find any reference to that in the documentation. > > Thank you for your help. > > Alex > > > -- > > 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 > > athttp://groups.google.com/group/sage-devel > > URL:http://www.sagemath.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 athttp://groups.google.com/group/sage-devel > URL:http://www.sagemath.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