示例#1
0
def get_grades_details(username,password,semester):
    dt = datetime.datetime.now()
    time = dt.strftime("%A, %d. %B %Y %I:%M%p")
    log = "grades" + str(username) +" " + str(semester) +" =>" +  str(time)
    with open("logs.txt", "a") as myfile:
        myfile.write(log)
    return get_grades(username,password,int(semester))
示例#2
0
def get_positif_cdc_grades():
    a = Allosession()
    resss = list()
    for x in a.all_films:
        resss.append({**x, **get_grades(x['code'])})

    positif_cdc_grades = [{
        "name": j["name"],
        "Positif": access_key_or_zero("Positif", j),
        "CdC": access_key_or_zero("Cahiers du cinéma", j)
    } for j in resss]

    return [[[
        film['name'] for film in positif_cdc_grades
        if film["Positif"] == n and film["CdC"] == m
    ] for m in range(6)] for n in range(6)]
def get_grades_details(username,password,semester):
    return get_grades(username,password,int(semester))
示例#4
0
def test_get_averages():
    grades = get_grades('grades.txt')
    avgs = get_averages(grades)
    assert avgs == [('bob', 85.33333333333333), ('sara', 98.0), ('sue', 83.5)]
示例#5
0
def test_get_grades():
    grades = get_grades('grades.txt')
    d = {'bob': [78.0, 88.0, 90.0], 'sara': [98.0], 'sue': [72.0, 95.0]}
    assert grades == d
示例#6
0
def test_rank_scores():
    grades = get_grades('grades.txt')
    avgs = get_averages(grades)
    rank = rank_scores(avgs)
    assert rank == [('sara', 98.0), ('bob', 85.33333333333333), ('sue', 83.5)]