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)
def test_float_not_exact(): assert utils.as_integer(1.5) == (False, 1.5)
def test_one(): assert utils.as_integer('one') == (True, 1)
def test_none(): assert utils.as_integer(None) == (False, None)
def test_float_exact(): assert utils.as_integer(1.0) == (True, 1)
def test_doce(): assert utils.as_integer('doce') == (True, 12)
def test_tres(): assert utils.as_integer('tres') == (True, 3)
def test_dos(): assert utils.as_integer('dos') == (True, 2)
def test_string_1(): assert utils.as_integer('1') == (True, 1)
def test_uno(): assert utils.as_integer('uno') == (True, 1)