aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 13c8725..bd289cc 100644
--- a/tests.py
+++ b/tests.py
@@ -97,6 +97,16 @@ class GroupTestCase(TestCase):
Group.objects.create(celcat_name="L1 info (toutes sections et "
"semestres confondus)", source=self.source)
+ # Cas spéciaux de groupes sans semestre. Normalement un groupe
+ # sans semestre ne possède pas de sous-groupe non plus, mais
+ # certains cas font foirer la regex. Voici un exemple trouvé
+ # dans la base de données de production.
+ Group.objects.create(celcat_name="M1 GC (toutes sections et semestres "
+ "confondus)", source=self.source)
+
+ # Doit appartenir au groupe au-dessus.
+ Group.objects.create(celcat_name="M1 GC s2 GA111", source=self.source)
+
def test_corresponds(self):
cma = Group.objects.get(celcat_name="L1 info s2 CMA",
source=self.source)
@@ -153,6 +163,15 @@ class GroupTestCase(TestCase):
self.assertTrue(tpa21.corresponds_to(*general.group_info))
self.assertTrue(tpb21.corresponds_to(*general.group_info))
+ def test_corresponds_no_semester(self):
+ general = Group.objects.get(celcat_name="M1 GC (toutes sections et "
+ "semestres confondus)", source=self.source)
+ ga111 = Group.objects.get(celcat_name="M1 GC s2 GA111",
+ source=self.source)
+
+ self.assertTrue(ga111.corresponds_to(*general.group_info))
+ self.assertFalse(general.corresponds_to(*ga111.group_info))
+
def test_get(self):
cma = Group.objects.get(name="L1 info s2 CMA", source=self.source)
tda2 = Group.objects.get(name="L1 info s2 TDA2", source=self.source)
@@ -204,6 +223,15 @@ class GroupTestCase(TestCase):
self.assertEqual(general.group_info, ("L1 info", None, ""))
+ def test_parse_no_semester(self):
+ general = Group.objects.get(celcat_name="M1 GC (toutes sections et "
+ "semestres confondus)", source=self.source)
+ ga111 = Group.objects.get(celcat_name="M1 GC s2 GA111",
+ source=self.source)
+
+ self.assertEqual(general.group_info, ("M1 GC", None, ""))
+ self.assertEqual(ga111.group_info, ("M1 GC", 2, "A111"))
+
class RoomTestCase(TestCase):
def setUp(self):