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

This commit is contained in:
Pavel "LEdoian" Turinsky 2019-08-14 14:08:56 +02:00
parent dbbaf4f1f7
commit e8e97355c7

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
from pytz import timezone
import random
import lorem
import django.contrib.auth
@ -121,9 +122,18 @@ def gen_organizatori(rnd, osoby, last_rocnik, users):
rand = rnd.randint(0, 8)
if (rand % 8 == 0):
pusobnost = rnd.randint(1, last_rocnik)
od = datetime.date(1993 + pusobnost, rnd.randint(1, 12), rnd.randint(1, 28))
do = datetime.date(od.year + rnd.randint(1, 6), rnd.randint(1, 12),
rnd.randint(1, 28))
od = datetime.datetime(
year=1993 + pusobnost,
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
if do.year > datetime.datetime.now().year:
do = None