- Timestamp:
- 28 Oct 2018, 17:30:45 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_vocabularies.py
r9778 r15203 65 65 studylevelsource = StudyLevelSource().factory 66 66 values = studylevelsource.getValues(studycourse) 67 self.assertEqual(values, [ 100, 110, 120, 200, 210, 220, 300, 310, 320,67 self.assertEqual(values, [0, 100, 110, 120, 200, 210, 220, 300, 310, 320, 68 68 400, 410, 420, 500, 510, 520, 600, 610, 620]) 69 69 # All titles do exist 70 70 titles = [studylevelsource.getTitle(studycourse, value) 71 71 for value in values] 72 self.assertEqual(len(titles), 1 8)72 self.assertEqual(len(titles), 19) 73 73 # Unfortunately, unittests don't know about internationalization 74 74 self.assertEqual(studylevelsource.getTitle(studycourse, None), 75 75 'Error: level id ${value} out of range') 76 76 self.assertEqual(studylevelsource.getTitle(studycourse, 0), 77 'Level Zero') 78 self.assertEqual(studylevelsource.getTitle(studycourse, 1), 77 79 'Error: level id ${value} out of range') 78 80 self.assertEqual(studylevelsource.getTitle(studycourse, 10), … … 96 98 self.assertEqual(studylevelsource.getTitle(studycourse, 700), 97 99 'Error: level id ${value} out of range') 98 # Now we modify the certificates to be a pure topre-studies100 # Now we modify the certificates to be a pure pre-studies 99 101 # course 100 102 studycourse.certificate.start_level = 10 101 103 studycourse.certificate.end_level = 10 102 104 values = studylevelsource.getValues(studycourse) 103 self.assertEqual(values, [ 10])105 self.assertEqual(values, [0, 10]) 104 106 titles = [studylevelsource.getTitle(studycourse, value) 105 107 for value in values] 106 self.assertEqual(len(titles), 1)108 self.assertEqual(len(titles), 2) 107 109 self.assertEqual(studylevelsource.getTitle(studycourse, 10), 108 110 'Pre-Studies') … … 115 117 studycourse.certificate.end_level = 200 116 118 values = studylevelsource.getValues(studycourse) 117 self.assertEqual(values, [ 10, 100, 110, 120,119 self.assertEqual(values, [0, 10, 100, 110, 120, 118 120 200, 210, 220, 300, 310, 320]) 119 121 titles = [studylevelsource.getTitle(studycourse, value) 120 122 for value in values] 121 self.assertEqual(len(titles), 1 0)123 self.assertEqual(len(titles), 11) 122 124 # Repeating Pre-Studies level does not exist and raises a KeyError 123 125 # when trying to get its title
Note: See TracChangeset for help on using the changeset viewer.