예제 #1
0
def track(bot, update, args):
    '''Listado de charlas de un track.
    '''
    is_valid, num_track = utils.as_integer(args[0])
    print('is_valid: {}, num_track: {}'.format(is_valid, num_track))
    if is_valid and E.is_valid_track(num_track):
        track = E.tracks[num_track - 1]
        text = templates.render(
            'templates/track.txt',
            num_track=num_track,
            track=track,
            talks=track.talks,
        )
        return True, str(text)
    else:
        return False, "Necesito un número entre 1 y {}".format(E.num_tracks)
예제 #2
0
def test_float_not_exact():
    assert utils.as_integer(1.5) == (False, 1.5)
예제 #3
0
def test_one():
    assert utils.as_integer('one') == (True, 1)
예제 #4
0
def test_none():
    assert utils.as_integer(None) == (False, None)
예제 #5
0
def test_float_exact():
    assert utils.as_integer(1.0) == (True, 1)
예제 #6
0
def test_doce():
    assert utils.as_integer('doce') == (True, 12)
예제 #7
0
def test_tres():
    assert utils.as_integer('tres') == (True, 3)
예제 #8
0
def test_dos():
    assert utils.as_integer('dos') == (True, 2)
예제 #9
0
def test_string_1():
    assert utils.as_integer('1') == (True, 1)
예제 #10
0
def test_uno():
    assert utils.as_integer('uno') == (True, 1)