Browse Source

testutil.py: odsazení

export_seznamu_prednasek
Tomáš Domes 6 years ago
parent
commit
0faf1d381e
  1. 30
      seminar/testutils.py

30
seminar/testutils.py

@ -116,7 +116,10 @@ def gen_organizatori(rnd, osoby, last_rocnik, users):
return organizatori return organizatori
def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size):
'''cislo = cislo cisla v rocniku, nikoli objekt Cislo ''' '''
cislo = cislo cisla v rocniku, nikoli objekt Cislo
'''
# ulohy resene v ci # ulohy resene v ci
jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá", jaka = ["Šachová", "Černá", "Větrná", "Dlouhá", "Křehká", "Rychlá",
"Zákeřná", "Fyzikální"] "Zákeřná", "Fyzikální"]
@ -152,8 +155,13 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size):
cislo_reseni=slovnik_cisel[cislo], cislo_reseni=slovnik_cisel[cislo],
cislo_deadline=slovnik_cisel[cislo], cislo_deadline=slovnik_cisel[cislo],
max_body = rnd.randint(1, 8)) max_body = rnd.randint(1, 8))
p.zadani = " ".join([rnd.choice(sloveso), rnd.choice(koho), p.zadani = " ".join(
rnd.choice(ceho), rnd.choice(jmeno), rnd.choice(kde)]) [rnd.choice(sloveso),
rnd.choice(koho),
rnd.choice(ceho),
rnd.choice(jmeno),
rnd.choice(kde)]
)
p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)]) p.vzorak = " - ".join([p.zadani, rnd.choice(reseni)])
p.save() p.save()
@ -164,11 +172,17 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size):
# (nebo skoro vsechny resitele, pokud jich je mene nez pocet reseni) # (nebo skoro vsechny resitele, pokud jich je mene nez pocet reseni)
res_vyber = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2)) res_vyber = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2))
for resitel in res_vyber: for resitel in res_vyber:
res = Reseni.objects.create(problem = p, res = Reseni.objects.create(
resitele=[resitel], problem = p,
forma=rnd.choice(Reseni.FORMA_CHOICES)) resitele=[resitel],
hod = Hodnoceni.objects.create(body=rnd.randint(0, p.max_body), forma=rnd.choice(Reseni.FORMA_CHOICES)
cislo_body=slovnik_cisel[cislo], reseni=res, problem=p) )
hod = Hodnoceni.objects.create(
body=rnd.randint(0, p.max_body),
cislo_body=slovnik_cisel[cislo],
reseni=res,
problem=p
)
return return
def gen_soustredeni(): def gen_soustredeni():

Loading…
Cancel
Save