|
|
@ -84,34 +84,34 @@ class DeadlineTestCase(TestCase): |
|
|
|
def test_deadline_spravne_vysledky(self): |
|
|
|
"""V každém intervalu mezi deadliny dostáváme ten správný deadline""" |
|
|
|
# První ročník |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-05-30')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='1'), date.fromisoformat('2000-09-11'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-09-15')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='1'), date.fromisoformat('2000-10-01'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-05-30')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='1'), date.fromisoformat('2000-09-11'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-09-15')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='1'), date.fromisoformat('2000-10-01'))) |
|
|
|
|
|
|
|
# Trochu divný případ, kdy někdo něco pošle před vydáním čísla. Ale článkům se to asi stát může… |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-10-10')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2000-12-05'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-10-22')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2000-12-05'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-12-15')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2001-01-02'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-01-08')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=1, poradi='3'), date.fromisoformat('2001-03-12'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-03-15')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-04-22')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-04-30')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-10-10')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2000-12-05'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-10-22')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2000-12-05'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2000-12-15')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='2'), date.fromisoformat('2001-01-02'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-01-08')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=1, poradi='3'), date.fromisoformat('2001-03-12'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-03-15')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-04-22')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-04-30')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
|
|
|
|
# Druhý ročník |
|
|
|
# Pro jistotu ještě prázdniny |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-07-30')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-09-27')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-10-07'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-12-27')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-03-15')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-03-15')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-07-30')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-09-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-09-27')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='1'), date.fromisoformat('2001-10-07'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2001-12-27')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-03-15')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-03-15')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-05-26'))) |
|
|
|
|
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-05-27')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-06-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-05-27')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-06-30'))) |
|
|
|
# Tohle je trochu podezřelý případ, protože relevantní deadliny existují dvě… Ale ten pro minulý ročník je těsnější a realističtější |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-06-03')), (TypDeadline.FinalDeadline, m.Cislo.object.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-06-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-07-01')), (TypDeadline.PredDeadline, m.Cislo.object.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-08-31'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-06-03')), (TypDeadline.FinalDeadline, m.Cislo.objects.get(rocnik__rocnik=2, poradi='2'), date.fromisoformat('2002-06-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-07-01')), (TypDeadline.PredDeadline, m.Cislo.objects.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-08-31'))) |
|
|
|
|
|
|
|
# Třetí ročník |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-09-01')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-09-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-09-05')), (TypDeadline.SousDeadline, m.Cislo.object.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-09-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-09-01')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-09-30'))) |
|
|
|
self.assertEqual(deadline(date.fromisoformat('2002-09-05')), (TypDeadline.SousDeadline, m.Cislo.objects.get(rocnik__rocnik=3, poradi='1'), date.fromisoformat('2002-09-30'))) |
|
|
|
|
|
|
|
def test_deadline_ve_zlomove_dny(self): |
|
|
|
"""Pro dny, kdy je deadline nebo vydání čísla, pořád dostáváme správné deadliny. |
|
|
|