Skip to content

Commit 86faa70

Browse files
committed
Finally remove specific profession phrasing
This removes the specific kinds of profession that were previously here as a hangover from the old days. From here on in, users can subclass Mentor or Mentee if they have specific needs.
1 parent 9c3b26a commit 86faa70

File tree

4 files changed

+11
-27
lines changed

4 files changed

+11
-27
lines changed

matching/mentee.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,15 @@
1010
class Mentee(Person):
1111
def __init__(self, **kwargs):
1212
"""
13-
Mentees should have a target profession. If they don't have a target profession, we assume it's the same one
14-
they're in at the moment
13+
Base class for mentees
1514
:param kwargs:
1615
"""
17-
if (profession := kwargs.get("target profession")) is not None:
16+
if kwargs.get("target_profession") or kwargs.get("target profession"):
1817
warnings.warn(
19-
"In version 7, 'target profession' will be deprecated in favour of"
20-
" 'profession'. If you need to keep using 'target profession', please"
21-
" subclass Mentee",
22-
PendingDeprecationWarning,
18+
"`target_profession` is now deprecated. Please use `profession`"
19+
" instead",
20+
DeprecationWarning,
2321
)
24-
self.target_profession = profession
25-
else:
26-
self.profession = self.target_profession = kwargs.get("profession", "")
2722
super(Mentee, self).__init__(**kwargs)
2823

2924
@property
@@ -36,7 +31,6 @@ def mentors(self, new_mentor: "Mentor"):
3631

3732
def core_to_dict(self):
3833
core = super(Mentee, self).core_to_dict()
39-
core[self.class_name()]["target profession"] = self.target_profession
4034
return core
4135

4236
@classmethod

matching/person.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ def __init__(self, **kwargs):
1414
"""
1515
self.grade: int = int(kwargs.get("grade"))
1616
self.organisation: str = kwargs.get("organisation", None)
17-
if (profession := kwargs.get("current profession")) is not None:
17+
self.profession = kwargs.get("profession", None)
18+
if kwargs.get("current_profession") or kwargs.get("current profession"):
1819
warnings.warn(
19-
"In version 7, 'current profession' will be deprecated in favour of"
20-
" 'profession'. If you need to keep using 'current profession', please"
21-
" subclass Person",
22-
PendingDeprecationWarning,
20+
"`current_profession` is deprecated. Use `profession` instead",
21+
DeprecationWarning,
2322
)
24-
self.current_profession = self.profession = profession
25-
else:
26-
self.profession = self.current_profession = kwargs.get("profession", "")
2723
self.email = kwargs.get("email", None)
2824
self.first_name = kwargs.get("first name", None)
2925
self.last_name = kwargs.get("last name", None)
@@ -66,7 +62,6 @@ def core_to_dict(self) -> CorePersonDict:
6662
"organisation": self.organisation,
6763
"grade": self.grade,
6864
"profession": self.profession,
69-
"current profession": self.current_profession,
7065
}
7166
}
7267

tests/conftest.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ def _known_file(path_to_file, role_type: str, quantity=50):
2121
"role",
2222
"organisation",
2323
"grade",
24-
"current profession",
25-
"target profession",
2624
]
2725
data = [headings]
2826
for i in range(quantity):
@@ -34,8 +32,6 @@ def _known_file(path_to_file, role_type: str, quantity=50):
3432
"Some role",
3533
f"Department of {role_type.capitalize()}s",
3634
"2" if role_type == "mentor" else "0",
37-
"Policy",
38-
"Policy",
3935
]
4036
)
4137
file_writer = csv.writer(test_data)
@@ -74,7 +70,7 @@ def base_data() -> dict:
7470
@pytest.fixture
7571
def base_mentee(base_data):
7672
mentee = Mentee(**base_data)
77-
mentee.target_profession = "Policy"
73+
mentee.profession = "Policy"
7874
return mentee
7975

8076

tests/test_rules.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class TestRules:
1616
def test_matching_scores_scores_correct_points(self, test_match):
1717
profession_rule = rl.Generic(
1818
{True: 4, False: 0},
19-
lambda match: match.mentee.target_profession
20-
== match.mentor.current_profession,
19+
lambda match: match.mentee.profession == match.mentor.profession,
2120
)
2221
assert profession_rule.apply(test_match) == 4
2322

0 commit comments

Comments
 (0)