Browse Source

testutils: oprava nefungujicich veci

export_seznamu_prednasek
Anet 6 years ago
parent
commit
f30392d92b
  1. 24
      seminar/testutils.py

24
seminar/testutils.py

@ -117,9 +117,7 @@ def gen_organizatori(osoby, last_rocnik):
return organizatori return organizatori
def gen_ulohy_do_cisla(cislo, organizatori, resitele, slovnik_cisel, size): def gen_ulohy_do_cisla(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í"]
@ -165,11 +163,11 @@ cislo = cislo cisla v rocniku, nikoli objekt Cislo
poc_resitel = rnd.randint(1, 3) poc_resitel = rnd.randint(1, 3)
res_sel = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2)) res_sel = rnd.sample(resitele, min(poc_reseni, len(resitele) - 2))
for resitel in res_sel: for resitel in res_sel:
res = Reseni.objects.create(problem = p, res = Reseni.objects.create(problem = p,
resitele=[resitel], resitele=[resitel],
forma=rnd.choice(Reseni.FORMA_CHOICES)) forma=rnd.choice(Reseni.FORMA_CHOICES))
hod = Hodnoceni.objects.create(body=rnd.randint(0, p.max_body), hod = Hodnoceni.objects.create(body=rnd.randint(0, p.max_body),
cislo_body=slovnik_cisel[cislo], reseni=res, problem=p) cislo_body=slovnik_cisel[cislo], reseni=res, problem=p)
return return
@ -280,17 +278,17 @@ def create_test_data(size = 6, rnd = None):
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(sloveso), rnd.choice(koho),
rnd.choice(ceho), rnd.choice(jmeno), rnd.choice(kde)]) 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()
# vytvor text # vytvor text
# vytvor TemaVCisleNode # vytvor TemaVCisleNode
if (rnd.randint(1, 3) % 3 == 0): if (rnd.randint(1, 3) % 3 == 0):
# vytvor mezicislo Node # vytvor mezicislo Node
pass

Loading…
Cancel
Save