Browse Source

Testdata: zlikvidovány RuntimeWarningy o chybějící časové zóně

export_seznamu_prednasek
Pavel "LEdoian" Turinsky 5 years ago
parent
commit
e8e97355c7
  1. 16
      seminar/testutils.py

16
seminar/testutils.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from pytz import timezone
import random import random
import lorem import lorem
import django.contrib.auth import django.contrib.auth
@ -121,9 +122,18 @@ def gen_organizatori(rnd, osoby, last_rocnik, users):
rand = rnd.randint(0, 8) rand = rnd.randint(0, 8)
if (rand % 8 == 0): if (rand % 8 == 0):
pusobnost = rnd.randint(1, last_rocnik) pusobnost = rnd.randint(1, last_rocnik)
od = datetime.date(1993 + pusobnost, rnd.randint(1, 12), rnd.randint(1, 28)) od = datetime.datetime(
do = datetime.date(od.year + rnd.randint(1, 6), rnd.randint(1, 12), year=1993 + pusobnost,
rnd.randint(1, 28)) month=rnd.randint(1, 12),
day=rnd.randint(1, 28),
tzinfo=timezone('CET'),
)
do = datetime.datetime(
year=od.year + rnd.randint(1, 6),
month=rnd.randint(1, 12),
day=rnd.randint(1, 28),
tzinfo=timezone('CET'),
)
#aktualni organizatori jeste nemaji vyplnene organizuje_do #aktualni organizatori jeste nemaji vyplnene organizuje_do
if do.year > datetime.datetime.now().year: if do.year > datetime.datetime.now().year:
do = None do = None

Loading…
Cancel
Save