aboutsummaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-26 18:27:55 +0100
committerAlban Gruin2017-11-26 18:27:55 +0100
commit772caa72ce7f80bfeb5fbb1d05b57838dafd48c3 (patch)
tree00482ecc09db0eefd0617c6f9225b7c3e6f96161 /tests.py
parentffffd9842dbaba0b0e89ff5f434f45792e2b73b6 (diff)
parent4998865c2d5e94c53547e44aed1dc825163c0c4a (diff)
Merge branch 'stable/0.12.z' into prod/pa1ch/0.y.zv0.12.0-pa1ch
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py74
1 files changed, 50 insertions, 24 deletions
diff --git a/tests.py b/tests.py
index 051c733..1425a84 100644
--- a/tests.py
+++ b/tests.py
@@ -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,29 +80,45 @@ 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)
- 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
+ general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable)
+
+ 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(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.assertTrue(tda2.corresponds_to(*cma.group_info))
+ self.assertTrue(tpa21.corresponds_to(*cma.group_info))
+ self.assertTrue(tpa21.corresponds_to(*tda2.group_info))
- 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(tdb2.corresponds_to(*cmb.group_info))
+ self.assertTrue(tpb21.corresponds_to(*cmb.group_info))
+ self.assertTrue(tpb21.corresponds_to(*tdb2.group_info))
- 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.assertFalse(tda2.corresponds_to(*cmb.group_info))
+ self.assertFalse(tpa21.corresponds_to(*cmb.group_info))
+ self.assertFalse(tpa21.corresponds_to(*tdb2.group_info))
- 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(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.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(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)
@@ -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,10 +150,14 @@ 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)
- self.assertEqual(cma.group_info, (self.timetable.id, "L1 info", "A"))
- self.assertEqual(tda2.group_info, (self.timetable.id, "L1 info", "A2"))
- self.assertEqual(tpa21.group_info, (self.timetable.id, "L1 info", "A21"))
+ general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable)
+
+ self.assertEqual(cma.group_info, ("L1 info", 2, "A"))
+ self.assertEqual(tda2.group_info, ("L1 info", 2, "A2"))
+ self.assertEqual(tpa21.group_info, ("L1 info", 2, "A21"))
+
+ self.assertEqual(cmb.group_info, ("L1 info", 2, "B"))
+ self.assertEqual(tdb2.group_info, ("L1 info", 2, "B2"))
+ self.assertEqual(tpb21.group_info, ("L1 info", 2, "B21"))
- self.assertEqual(cmb.group_info, (self.timetable.id, "L1 info", "B"))
- self.assertEqual(tdb2.group_info, (self.timetable.id, "L1 info", "B2"))
- self.assertEqual(tpb21.group_info, (self.timetable.id, "L1 info", "B21"))
+ self.assertEqual(general.group_info, ("L1 info", None, ""))