aboutsummaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index c3d34fd..2568688 100644
--- a/tests.py
+++ b/tests.py
@@ -113,6 +113,11 @@ class GroupTestCase(TestCase):
Group.objects.create(celcat_name="M1 CHI-TCCM (EM) s2 TPA12",
source=self.source)
+ # Cas spécial avec un nombre supplémentaire dans le nom de groupe
+ Group.objects.create(celcat_name="L1 4L s1 CM4L", source=self.source)
+ Group.objects.create(celcat_name="L1 4L s1 TD4L1", source=self.source)
+ Group.objects.create(celcat_name="L1 4L s1 TP4L12", source=self.source)
+
def test_corresponds(self):
cma = Group.objects.get(celcat_name="L1 info s2 CMA",
source=self.source)
@@ -178,6 +183,22 @@ class GroupTestCase(TestCase):
self.assertTrue(ga111.corresponds_to(*general.group_info))
self.assertFalse(general.corresponds_to(*ga111.group_info))
+ def test_corresponds_number(self):
+ cm4l = Group.objects.get(celcat_name="L1 4L s1 CM4L",
+ source=self.source)
+ td4l1 = Group.objects.get(celcat_name="L1 4L s1 TD4L1",
+ source=self.source)
+ tp4l12 = Group.objects.get(celcat_name="L1 4L s1 TP4L12",
+ source=self.source)
+
+ self.assertFalse(cm4l.corresponds_to(*td4l1.group_info))
+ self.assertFalse(cm4l.corresponds_to(*tp4l12.group_info))
+ self.assertFalse(td4l1.corresponds_to(*tp4l12.group_info))
+
+ self.assertTrue(td4l1.corresponds_to(*cm4l.group_info))
+ self.assertTrue(tp4l12.corresponds_to(*cm4l.group_info))
+ self.assertTrue(tp4l12.corresponds_to(*td4l1.group_info))
+
def test_correspond_parenthesis(self):
general = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) (toutes"
" sections et semestres confondus)")
@@ -246,6 +267,18 @@ class GroupTestCase(TestCase):
self.assertEqual(general.group_info, ("M1 GC", None, ""))
self.assertEqual(ga111.group_info, ("M1 GC", 2, "A111"))
+ def test_parse_number(self):
+ cm4l = Group.objects.get(celcat_name="L1 4L s1 CM4L",
+ source=self.source)
+ td4l1 = Group.objects.get(celcat_name="L1 4L s1 TD4L1",
+ source=self.source)
+ tp4l12 = Group.objects.get(celcat_name="L1 4L s1 TP4L12",
+ source=self.source)
+
+ self.assertEqual(cm4l.group_info, ("L1 4L", 1, "4L"))
+ self.assertEqual(td4l1.group_info, ("L1 4L", 1, "4L1"))
+ self.assertEqual(tp4l12.group_info, ("L1 4L", 1, "4L12"))
+
def test_parse_parenthesis(self):
general = Group.objects.get(celcat_name="M1 CHI-TCCM (EM) (toutes"
" sections et semestres confondus)")