Ticket #9958: trac_9958-nfactor_enumerable_word-randomness.patch

File trac_9958-nfactor_enumerable_word-randomness.patch, 1.4 KB (added by fbissey, 9 years ago)

take into account the randomness of it.next sequence of call - put random in the right place this time.

  • sage/combinat/words/nfactor_enumerable_word.py

    # HG changeset patch
    # User Francois Bissey <francois.bissey@canterbury.ac.nz>
    # Date 1323603049 -46800
    # Node ID 27b676bc8b4d15d20aa3792b7dc698e0031b2e06
    # Parent  df5620969fbddef0cf191407d046c2ed522d6a49
    trac 9958: it.next() successive values are in random order, this is really apparent with python 2.7.
    
    diff --git a/sage/combinat/words/nfactor_enumerable_word.py b/sage/combinat/words/nfactor_enumerable_word.py
    a b  
    1313
    1414EXAMPLES:
    1515
    16 Enumeration of factors::
     16Enumeration of factors, the successive values returned by it.next()                                                                         
     17can appear in a different order depending on hardware. Therefore we                                                                         
     18mark the three first results of the test random. The important test                                                                         
     19is that the iteration stops properly on the fourth call::
    1720
    1821    sage: w = Word([4,5,6])^7
    1922    sage: it = w.factor_iterator(4)
    20     sage: it.next()
     23    sage: it.next() # random
    2124    word: 6456
    22     sage: it.next()
     25    sage: it.next() # random
    2326    word: 5645
    24     sage: it.next()
     27    sage: it.next() # random
    2528    word: 4564
    2629    sage: it.next()
    2730    Traceback (most recent call last):