Skip to content

Commit 17f6051

Browse files
authored
Add tests for yaml object format (#114)
1 parent 992a380 commit 17f6051

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/models/test_utils.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,58 @@ def test_extract_candidate_info(candidate_md: str):
5555
}
5656

5757

58+
def test_extract_candidate_info_array_format():
59+
# This is the old/non-standard format, but we should still test for it for backwards compatibility.
60+
"""Test parsing candidate info with array format"""
61+
candidate_md_array = """-------------------------------------------------------------
62+
name: Jane Doe
63+
ID: jdoe
64+
info:
65+
- employer: Example Corp
66+
- slack: jane.doe
67+
-------------------------------------------------------------
68+
69+
## Bio
70+
71+
Sample bio content here.
72+
"""
73+
info = extract_candidate_info(candidate_md_array)
74+
assert info == {
75+
'name': 'Jane Doe',
76+
'ID': 'jdoe',
77+
'info': [
78+
{'employer': 'Example Corp'},
79+
{'slack': 'jane.doe'}
80+
]
81+
}
82+
83+
84+
def test_extract_candidate_info_object_format():
85+
# This is the proper yaml format
86+
"""Test parsing candidate info with object format"""
87+
candidate_md_object = """-------------------------------------------------------------
88+
name: John Smith
89+
ID: jsmith
90+
info:
91+
employer: Tech Company
92+
slack: john.smith
93+
-------------------------------------------------------------
94+
95+
## Bio
96+
97+
Sample bio content here.
98+
"""
99+
info = extract_candidate_info(candidate_md_object)
100+
assert info == {
101+
'name': 'John Smith',
102+
'ID': 'jsmith',
103+
'info': {
104+
'employer': 'Tech Company',
105+
'slack': 'john.smith'
106+
}
107+
}
108+
109+
58110
def test_extract_candidate_description(candidate_md):
59111
assert extract_candidate_description(candidate_md) == (
60112
'## Reason for Name\n\n'

0 commit comments

Comments
 (0)