diff options
author | Alban Gruin | 2017-11-24 20:02:21 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-24 20:02:21 +0100 |
commit | b28630da06a6c1286d5cd34d6437d8dd19d6f298 (patch) | |
tree | 9e9fc9ff12fb11b43a462592bb844d977f3be209 | |
parent | 74f7317251ec068e89ee02d386b902d53f366840 (diff) |
Ajout de nouveaux tests pour ces nouveaux cas
-rw-r--r-- | models.py | 3 | ||||
-rw-r--r-- | tests.py | 26 |
2 files changed, 28 insertions, 1 deletions
@@ -116,7 +116,8 @@ class Group(models.Model): self.subgroup.startswith(subgroup) return self.timetable.id == timetable_id and \ - self.mention.startswith(mention) and \ + (self.mention.startswith(mention) or \ + mention.startswith(self.mention)) and \ subgroup_corresponds @property @@ -69,6 +69,8 @@ class GroupTestCase(TestCase): Group.objects.create(celcat_name="L1 info s2 TDB2", timetable=self.timetable) Group.objects.create(celcat_name="L1 info s2 TPB21", timetable=self.timetable) + Group.objects.create(celcat_name="L1 info (toutes sections et semestres confondus)", 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) @@ -78,6 +80,8 @@ class GroupTestCase(TestCase): tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", timetable=self.timetable) tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", timetable=self.timetable) + general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable) + self.assertTrue(cma.corresponds_to(*tda2.group_info)) # CMA corresponds to TDA2 self.assertTrue(cma.corresponds_to(*tpa21.group_info)) # CMA corresponds to TPA21 self.assertTrue(tda2.corresponds_to(*tpa21.group_info)) # TDA2 corresponds to TPA21 @@ -102,6 +106,20 @@ class GroupTestCase(TestCase): self.assertFalse(tpa21.corresponds_to(*cmb.group_info)) # TPA21 does not corresponds to CMB self.assertFalse(tpa21.corresponds_to(*tdb2.group_info)) # TPA21 does not corresponds to TDB2 + self.assertTrue(general.corresponds_to(*cma.group_info)) + self.assertTrue(general.corresponds_to(*cmb.group_info)) + self.assertTrue(general.corresponds_to(*tda2.group_info)) + self.assertTrue(general.corresponds_to(*tdb2.group_info)) + self.assertTrue(general.corresponds_to(*tpa21.group_info)) + self.assertTrue(general.corresponds_to(*tpb21.group_info)) + + self.assertTrue(cma.corresponds_to(*general.group_info)) + self.assertTrue(cmb.corresponds_to(*general.group_info)) + self.assertTrue(tda2.corresponds_to(*general.group_info)) + self.assertTrue(tdb2.corresponds_to(*general.group_info)) + self.assertTrue(tpa21.corresponds_to(*general.group_info)) + self.assertTrue(tpb21.corresponds_to(*general.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) @@ -111,6 +129,8 @@ class GroupTestCase(TestCase): tdb2 = Group.objects.get(name="L1 info s2 TDB2", timetable=self.timetable) tpb21 = Group.objects.get(name="L1 info s2 TPB21", timetable=self.timetable) + general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable) + self.assertEqual(cma.celcat_name, "L1 info s2 CMA") self.assertEqual(tda2.celcat_name, "L1 info s2 TDA2") self.assertEqual(tpa21.celcat_name, "L1 info s2 TPA21") @@ -119,6 +139,8 @@ class GroupTestCase(TestCase): self.assertEqual(tdb2.celcat_name, "L1 info s2 TDB2") self.assertEqual(tpb21.celcat_name, "L1 info s2 TPB21") + self.assertEqual(general.celcat_name, "L1 info (toutes sections et semestres confondus)") + def test_parse(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) @@ -128,6 +150,8 @@ class GroupTestCase(TestCase): tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", timetable=self.timetable) tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", timetable=self.timetable) + general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable) + self.assertEqual(cma.group_info, (self.timetable.id, "L1 info s2 ", "A")) self.assertEqual(tda2.group_info, (self.timetable.id, "L1 info s2 ", "A2")) self.assertEqual(tpa21.group_info, (self.timetable.id, "L1 info s2 ", "A21")) @@ -135,3 +159,5 @@ class GroupTestCase(TestCase): self.assertEqual(cmb.group_info, (self.timetable.id, "L1 info s2 ", "B")) self.assertEqual(tdb2.group_info, (self.timetable.id, "L1 info s2 ", "B2")) self.assertEqual(tpb21.group_info, (self.timetable.id, "L1 info s2 ", "B21")) + + self.assertEqual(general.group_info, (self.timetable.id, "L1 info ", "")) |