Exemplo n.º 1
0
def random_enum(maxEnumSize, randChars="abeE01" + "$%+-.;|\t ", quoteChars="\'\""):
    choiceStr = randChars + quoteChars
    mightBeNumberOrWhite = True
    while mightBeNumberOrWhite:
        # H2O doesn't seem to tolerate random single or double quote in the first two rows.
        # disallow that by not passing quoteChars for the first two rows (in call to here)
        r = ''.join(random.choice(choiceStr) for x in range(maxEnumSize))
        mightBeNumberOrWhite = h2o_util.might_h2o_think_number_or_whitespace(r)
    return r
Exemplo n.º 2
0
def random_enum(maxEnumSize, randChars="abeE01" + "$%+-.;|\t ", quoteChars="\'\""):
    choiceStr = randChars + quoteChars
    mightBeNumberOrWhite = True
    while mightBeNumberOrWhite:
        # H2O doesn't seem to tolerate random single or double quote in the first two rows.
        # disallow that by not passing quoteChars for the first two rows (in call to here)
        r = ''.join(random.choice(choiceStr) for x in range(maxEnumSize))
        mightBeNumberOrWhite = h2o_util.might_h2o_think_number_or_whitespace(r)
    return r
Exemplo n.º 3
0
def random_enum(width, randChars=randChars, quoteChars=quoteChars):
    # randomly return None 10% of the time
    # if random.randint(0,9)==0:
    #    return 'huh' # empty string doesn't work for exec compare?

    choiceStr = randChars + quoteChars
    mightBeNumberOrWhite = True
    while mightBeNumberOrWhite:
        # H2O doesn't seem to tolerate random single or double quote in the first two rows.
        # disallow that by not passing quoteChars for the first two rows (in call to here)
        r = ''.join(random.choice(choiceStr) for x in range(width))
        mightBeNumberOrWhite = h2o_util.might_h2o_think_number_or_whitespace(r)

    return r
def random_enum(n, randChars=randChars, quoteChars=quoteChars):
    # randomly return None 10% of the time
    # if random.randint(0,9)==0:
    #    return 'huh' # empty string doesn't work for exec compare?

    choiceStr = randChars + quoteChars
    mightBeNumberOrWhite = True
    while mightBeNumberOrWhite:
        # H2O doesn't seem to tolerate random single or double quote in the first two rows.
        # disallow that by not passing quoteChars for the first two rows (in call to here)
        r = ''.join(random.choice(choiceStr) for x in range(n))
        mightBeNumberOrWhite = h2o_util.might_h2o_think_number_or_whitespace(r)

    return r