aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2018-04-03 00:24:41 +0200
committerAlban Gruin2018-04-03 00:27:07 +0200
commit471ce869885ad87bcf8f18d53f365d9d1ed628ab (patch)
tree541c3f4aae9d83f14b67a1053ae3f3906d0301d8
parente02f3779d788679958d1dc9656babacc6bfbe238 (diff)
Ajout de cas de tests de groupes avec des parenthèses dans le nom
-rw-r--r--tests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 38c0ed8..24141c1 100644
--- a/tests.py
+++ b/tests.py
@@ -81,6 +81,12 @@ class GroupTestCase(TestCase):
# Doit appartenir au groupe au-dessus.
Group.objects.create(celcat_name="M1 GC s2 GA111", timetable=self.timetable)
+ # Cas spécial avec les parenthèses
+ Group.objects.create(celcat_name="M1 CHI-TCCM (EM) (toutes sections et"
+ " semestres confondus)", timetable=self.timetable)
+ Group.objects.create(celcat_name="M1 CHI-TCCM (EM) s2 TPA12",
+ timetable=self.timetable)
+
def test_corresponds(self):
cma = Group.objects.get(celcat_name="L1 info s2 CMA", timetable=self.timetable)
tda2 = Group.objects.get(celcat_name="L1 info s2 TDA2", timetable=self.timetable)
@@ -139,6 +145,14 @@ class GroupTestCase(TestCase):
self.assertTrue(ga111.corresponds_to(*general.group_info))
self.assertFalse(general.corresponds_to(*ga111.group_info))
+ def test_correspond_parenthesis(self):
+ general = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) (toutes"
+ " sections et semestres confondus)")
+ a12 = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) s2 TPA12")
+
+ self.assertTrue(a12.corresponds_to(*general.group_info))
+ self.assertFalse(general.corresponds_to(*a12.group_info))
+
def test_get(self):
cma = Group.objects.get(name="L1 info s2 CMA", timetable=self.timetable)
tda2 = Group.objects.get(name="L1 info s2 TDA2", timetable=self.timetable)
@@ -190,3 +204,10 @@ class GroupTestCase(TestCase):
self.assertEqual(general.group_info, ("M1 GC", None, ""))
self.assertEqual(ga111.group_info, ("M1 GC", 2, "A111"))
+ def test_parse_parenthesis(self):
+ general = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) (toutes"
+ " sections et semestres confondus)")
+ a12 = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) s2 TPA12")
+
+ self.assertEqual(general.group_info, ("M1 CHI-TCCM (EM)", None, ""))
+ self.assertEqual(a12.group_info, ("M1 CHI-TCCM (EM)", 2, "A12"))