-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f438f48
commit 91a7614
Showing
5 changed files
with
153 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from .test_selector import TestBase | ||
from auxiclean import Selector | ||
from unittest.mock import patch | ||
|
||
|
||
@patch('auxiclean.user_input.get_user_input') | ||
class TestCandidateNoGPA(TestBase): | ||
# two different courses | ||
courses = {"Electro": {"code": "1441", | ||
"disponibilities": 1, | ||
"discipline": "générale"}} | ||
# two candidates each applying for a different course. | ||
# they are equals. so we must choose 1 | ||
candidates = {"Albert A": {"maximum": 2, | ||
"scolarity": 2, | ||
"courses given": [], | ||
"nobels": 0, | ||
"discipline": "générale", | ||
"choices": ["1441", ], | ||
"gpa": ""}, # no gpa | ||
"Claude C": {"maximum": 2, | ||
"scolarity": 2, | ||
"courses given": [], | ||
"nobels": 0, | ||
"discipline": "générale", | ||
"choices": ["1441", ], | ||
"gpa": ""}, } # no gpa | ||
|
||
def test_no_gpa(self, user_input): | ||
# test that gpa is not considered if it | ||
# is not given | ||
user_input.side_effect = ["1", "oui"] | ||
self.selector = Selector(self.data_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from .test_selector import TestBase | ||
from auxiclean import Selector | ||
|
||
|
||
class TestCourseRaise(TestBase): | ||
courses = {"Electro": {"code": "", # no code | ||
"disponibilities": 1, | ||
"discipline": "générale"}} | ||
candidates = {"Albert A": {"maximum": 2, | ||
"scolarity": 2, | ||
"courses given": ["1441", "2710", "2710", | ||
"2710", "2710", "1620"], | ||
"nobels": 0, | ||
"discipline": "générale", | ||
"choices": ["1441", ], | ||
"gpa": 2.6}} | ||
|
||
def test_no_code(self): | ||
with self.assertRaises(ValueError): | ||
self.selector = Selector(self.data_path) | ||
|
||
|
||
class TestCourseNoName(TestBase): | ||
courses = {"": {"code": "1441", # no name | ||
"disponibilities": 1, | ||
"discipline": "générale"}} | ||
candidates = {"Albert A": {"maximum": 2, | ||
"scolarity": 2, | ||
"courses given": ["1441", "2710", "2710", | ||
"2710", "2710", "1620"], | ||
"nobels": 0, | ||
"discipline": "générale", | ||
"choices": ["1441", ], | ||
"gpa": 2.6}} | ||
|
||
def test_no_name(self): | ||
self.selector = Selector(self.data_path) | ||
course = self.selector.excel_mgr.courses[0] | ||
self.assertEqual(course.name, course.code) | ||
|
||
|
||
class TestCourseNoDiscipline(TestBase): | ||
courses = {"Electro": {"code": "1441", | ||
"disponibilities": 1, | ||
"discipline": ""}} # no discipline | ||
candidates = {"Albert A": {"maximum": 2, | ||
"scolarity": 2, | ||
"courses given": ["1441", "2710", "2710", | ||
"2710", "2710", "1620"], | ||
"nobels": 0, | ||
"discipline": "générale", | ||
"choices": ["1441", ], | ||
"gpa": 2.6}} | ||
|
||
def test_no_discipline(self): | ||
self.selector = Selector(self.data_path) | ||
course = self.selector.excel_mgr.courses[0] | ||
self.assertEqual(course.discipline, "générale") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters