aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-11-25 14:01:54 +0100
committerAlban Gruin2017-11-25 14:01:54 +0100
commitd9e0cba8c24978150e66b9ccd7ea67aa50a5f22d (patch)
tree3d447210d59606aa1ceaa2457f76590e979658d7
parent7f146b306760e1a70e8e1a79d58fc967d05fe194 (diff)
Un groupe parent ne correspond plus à un groupe enfant
Modification des tests
-rw-r--r--models.py3
-rw-r--r--tests.py60
2 files changed, 31 insertions, 32 deletions
diff --git a/models.py b/models.py
index 9838377..bde27a7 100644
--- a/models.py
+++ b/models.py
@@ -101,8 +101,7 @@ class Group(models.Model):
def corresponds_to(self, timetable_id, mention, subgroup):
subgroup_corresponds = True
if self.subgroup is not None and subgroup is not None:
- subgroup_corresponds = subgroup.startswith(self.subgroup) or \
- self.subgroup.startswith(subgroup)
+ subgroup_corresponds = self.subgroup.startswith(subgroup)
return self.timetable.id == timetable_id and \
(self.mention.startswith(mention) or \
diff --git a/tests.py b/tests.py
index a509f38..e7af6a8 100644
--- a/tests.py
+++ b/tests.py
@@ -82,36 +82,36 @@ class GroupTestCase(TestCase):
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
-
- self.assertTrue(cmb.corresponds_to(*tdb2.group_info)) # CMB corresponds to TDB2
- self.assertTrue(cmb.corresponds_to(*tpb21.group_info)) # CMB corresponds to TPB21
- self.assertTrue(tdb2.corresponds_to(*tpb21.group_info)) # TDB2 corresponds to TPB21
-
- self.assertFalse(cmb.corresponds_to(*tda2.group_info)) # CMB does not corresponds to TDA2
- self.assertFalse(cmb.corresponds_to(*tpa21.group_info)) # CMB does not corresponds to TPA21
- self.assertFalse(tdb2.corresponds_to(*tpa21.group_info)) # TDB2 does not corresponds to TPA21
-
- self.assertTrue(tda2.corresponds_to(*cma.group_info)) # TDA2 corresponds to CMA
- self.assertTrue(tpa21.corresponds_to(*cma.group_info)) # TPA21 corresponds to CMA
- self.assertTrue(tpa21.corresponds_to(*tda2.group_info)) # TPA21 corresponds to TDA2
-
- self.assertTrue(tdb2.corresponds_to(*cmb.group_info)) # TDB2 corresponds to CMB
- self.assertTrue(tpb21.corresponds_to(*cmb.group_info)) # TPB21 corresponds to CMB
- self.assertTrue(tpb21.corresponds_to(*tdb2.group_info)) # TPB21 corresponds to TDB2
-
- self.assertFalse(tda2.corresponds_to(*cmb.group_info)) # TDA2 does not corresponds to CMB
- 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.assertFalse(cma.corresponds_to(*tda2.group_info))
+ self.assertFalse(cma.corresponds_to(*tpa21.group_info))
+ self.assertFalse(tda2.corresponds_to(*tpa21.group_info))
+
+ self.assertFalse(cmb.corresponds_to(*tdb2.group_info))
+ self.assertFalse(cmb.corresponds_to(*tpb21.group_info))
+ self.assertFalse(tdb2.corresponds_to(*tpb21.group_info))
+
+ self.assertFalse(cmb.corresponds_to(*tda2.group_info))
+ self.assertFalse(cmb.corresponds_to(*tpa21.group_info))
+ self.assertFalse(tdb2.corresponds_to(*tpa21.group_info))
+
+ self.assertTrue(tda2.corresponds_to(*cma.group_info))
+ self.assertTrue(tpa21.corresponds_to(*cma.group_info))
+ self.assertTrue(tpa21.corresponds_to(*tda2.group_info))
+
+ self.assertTrue(tdb2.corresponds_to(*cmb.group_info))
+ self.assertTrue(tpb21.corresponds_to(*cmb.group_info))
+ self.assertTrue(tpb21.corresponds_to(*tdb2.group_info))
+
+ self.assertFalse(tda2.corresponds_to(*cmb.group_info))
+ self.assertFalse(tpa21.corresponds_to(*cmb.group_info))
+ self.assertFalse(tpa21.corresponds_to(*tdb2.group_info))
+
+ self.assertFalse(general.corresponds_to(*cma.group_info))
+ self.assertFalse(general.corresponds_to(*cmb.group_info))
+ self.assertFalse(general.corresponds_to(*tda2.group_info))
+ self.assertFalse(general.corresponds_to(*tdb2.group_info))
+ self.assertFalse(general.corresponds_to(*tpa21.group_info))
+ self.assertFalse(general.corresponds_to(*tpb21.group_info))
self.assertTrue(cma.corresponds_to(*general.group_info))
self.assertTrue(cmb.corresponds_to(*general.group_info))