diff options
author | Alban Gruin | 2018-01-27 17:56:45 +0100 |
---|---|---|
committer | Alban Gruin | 2018-01-27 18:13:25 +0100 |
commit | c9388e29b2f9ee18a9e190683a8a33fb710684c5 (patch) | |
tree | 1d9402e02719110d3a0f15b74500b57afe0d2fd4 /tests.py | |
parent | 465c1c13f2e5a77f296de92d4b5b14cf319c68c5 (diff) |
PEP8
Diffstat (limited to 'tests.py')
-rw-r--r-- | tests.py | 99 |
1 files changed, 66 insertions, 33 deletions
@@ -28,29 +28,42 @@ class CourseTestCase(TestCase): source = Source(url="http://example.org/") source.save() - self.timetable = Timetable(year=self.year, name="Test timetable 2", source=source, slug="test-timetable2") + self.timetable = Timetable(year=self.year, name="Test timetable 2", + source=source, slug="test-timetable2") self.timetable.save() cma = Group.objects.create(celcat_name="L1 info s2 CMA", source=source) - tda2 = Group.objects.create(celcat_name="L1 info s2 TDA2", source=source) - self.tpa21 = Group.objects.create(celcat_name="L1 info s2 TPA21", source=source) + tda2 = Group.objects.create(celcat_name="L1 info s2 TDA2", + source=source) + self.tpa21 = Group.objects.create(celcat_name="L1 info s2 TPA21", + source=source) cmb = Group.objects.create(celcat_name="L1 info s2 CMB", source=source) - tdb2 = Group.objects.create(celcat_name="L1 info s2 TDB2", source=source) - self.tpb21 = Group.objects.create(celcat_name="L1 info s2 TPB21", source=source) + tdb2 = Group.objects.create(celcat_name="L1 info s2 TDB2", + source=source) + self.tpb21 = Group.objects.create(celcat_name="L1 info s2 TPB21", + source=source) for group in (cma, tda2, self.tpa21, cmb, tdb2, self.tpb21,): - course = Course.objects.create(name="{0} course".format(group.name), type="cours", source=source, begin=dt, end=dt) + course = Course.objects.create(name="{0} course" + .format(group.name), + type="cours", source=source, + begin=dt, end=dt) course.groups.add(group) def test_get_courses_for_group(self): tpa21_courses = Course.objects.get_courses(self.tpa21) tpb21_courses = Course.objects.get_courses(self.tpb21) - tpa21_course_names = ["L1 info s2 CMA course", "L1 info s2 TDA2 course", "L1 info s2 TPA21 course"] - tpb21_course_names = ["L1 info s2 CMB course", "L1 info s2 TDB2 course", "L1 info s2 TPB21 course"] + tpa21_course_names = ["L1 info s2 CMA course", + "L1 info s2 TDA2 course", + "L1 info s2 TPA21 course"] + tpb21_course_names = ["L1 info s2 CMB course", + "L1 info s2 TDB2 course", + "L1 info s2 TPB21 course"] - for courses, names in ((tpa21_courses, tpa21_course_names,), (tpb21_courses, tpb21_course_names,),): + for courses, names in ((tpa21_courses, tpa21_course_names,), + (tpb21_courses, tpb21_course_names,),): for course in courses: self.assertIn(course.name, names) names.remove(course.name) @@ -64,29 +77,40 @@ class GroupTestCase(TestCase): self.source = Source(url="http://example.org/") self.source.save() - self.timetable = Timetable(year=self.year, name="Test timetable", source=self.source, slug="test-timetable") + self.timetable = Timetable(year=self.year, name="Test timetable", + source=self.source, slug="test-timetable") self.timetable.save() Group.objects.create(celcat_name="L1 info s2 CMA", source=self.source) Group.objects.create(celcat_name="L1 info s2 TDA2", source=self.source) - Group.objects.create(celcat_name="L1 info s2 TPA21", source=self.source) + Group.objects.create(celcat_name="L1 info s2 TPA21", + source=self.source) Group.objects.create(celcat_name="L1 info s2 CMB", source=self.source) Group.objects.create(celcat_name="L1 info s2 TDB2", source=self.source) - Group.objects.create(celcat_name="L1 info s2 TPB21", source=self.source) + Group.objects.create(celcat_name="L1 info s2 TPB21", + source=self.source) - Group.objects.create(celcat_name="L1 info (toutes sections et semestres confondus)", source=self.source) + Group.objects.create(celcat_name="L1 info (toutes sections et " + "semestres confondus)", source=self.source) def test_corresponds(self): - cma = Group.objects.get(celcat_name="L1 info s2 CMA", source=self.source) - tda2 = Group.objects.get(celcat_name="L1 info s2 TDA2", source=self.source) - tpa21 = Group.objects.get(celcat_name="L1 info s2 TPA21", source=self.source) - - cmb = Group.objects.get(celcat_name="L1 info s2 CMB", source=self.source) - tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", source=self.source) - tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", source=self.source) - - general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", source=self.source) + cma = Group.objects.get(celcat_name="L1 info s2 CMA", + source=self.source) + tda2 = Group.objects.get(celcat_name="L1 info s2 TDA2", + source=self.source) + tpa21 = Group.objects.get(celcat_name="L1 info s2 TPA21", + source=self.source) + + cmb = Group.objects.get(celcat_name="L1 info s2 CMB", + source=self.source) + tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", + source=self.source) + tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", + source=self.source) + + general = Group.objects.get(celcat_name="L1 info (toutes sections et " + "semestres confondus)", source=self.source) self.assertFalse(cma.corresponds_to(*tda2.group_info)) self.assertFalse(cma.corresponds_to(*tpa21.group_info)) @@ -135,7 +159,8 @@ class GroupTestCase(TestCase): tdb2 = Group.objects.get(name="L1 info s2 TDB2", source=self.source) tpb21 = Group.objects.get(name="L1 info s2 TPB21", source=self.source) - general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", source=self.source) + general = Group.objects.get(celcat_name="L1 info (toutes sections et " + "semestres confondus)", source=self.source) self.assertEqual(cma.celcat_name, "L1 info s2 CMA") self.assertEqual(tda2.celcat_name, "L1 info s2 TDA2") @@ -145,18 +170,26 @@ 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)") + 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", source=self.source) - tda2 = Group.objects.get(celcat_name="L1 info s2 TDA2", source=self.source) - tpa21 = Group.objects.get(celcat_name="L1 info s2 TPA21", source=self.source) - - cmb = Group.objects.get(celcat_name="L1 info s2 CMB", source=self.source) - tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", source=self.source) - tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", source=self.source) - - general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", source=self.source) + cma = Group.objects.get(celcat_name="L1 info s2 CMA", + source=self.source) + tda2 = Group.objects.get(celcat_name="L1 info s2 TDA2", + source=self.source) + tpa21 = Group.objects.get(celcat_name="L1 info s2 TPA21", + source=self.source) + + cmb = Group.objects.get(celcat_name="L1 info s2 CMB", + source=self.source) + tdb2 = Group.objects.get(celcat_name="L1 info s2 TDB2", + source=self.source) + tpb21 = Group.objects.get(celcat_name="L1 info s2 TPB21", + source=self.source) + + general = Group.objects.get(celcat_name="L1 info (toutes sections et " + "semestres confondus)", source=self.source) self.assertEqual(cma.group_info, ("L1 info", 2, "A")) self.assertEqual(tda2.group_info, ("L1 info", 2, "A2")) |