tests: update

This commit is contained in:
Sina Atalay 2024-03-10 18:13:32 +01:00
parent 9ccec151d6
commit 8be9249d95
3 changed files with 15 additions and 15 deletions

View File

@ -64,7 +64,7 @@ publication_entry_dictionary = {
}
one_line_entry_dictionary = {
"name": "Programming",
"label": "Programming",
"details": "Python, C++, JavaScript, MATLAB",
}

View File

@ -285,7 +285,7 @@ def test_invalid_publication_dates(publication_entry, date):
("invalid_start_date", "2021-01-01", None),
("2020-99-99", "2021-01-01", None),
("2020-10-12", "2020-99-99", None),
(None, None, "2020-20-20")
(None, None, "2020-20-20"),
],
)
def test_invalid_dates(start_date, end_date, date):
@ -346,25 +346,25 @@ def test_social_network_url(network, username, expected_url):
(
"publication_entry",
"PublicationEntry",
dm.SectionWithPublicationEntries,
"SectionWithPublicationEntries",
),
(
"experience_entry",
"ExperienceEntry",
dm.SectionWithExperienceEntries,
"SectionWithExperienceEntries",
),
(
"education_entry",
"EducationEntry",
dm.SectionWithEducationEntries,
"SectionWithEducationEntries",
),
(
"normal_entry",
"NormalEntry",
dm.SectionWithNormalEntries,
"SectionWithNormalEntries",
),
("one_line_entry", "OneLineEntry", dm.SectionWithOneLineEntries),
("text_entry", "TextEntry", dm.SectionWithTextEntries),
("one_line_entry", "OneLineEntry", "SectionWithOneLineEntries"),
("text_entry", "TextEntry", "SectionWithTextEntries"),
],
)
def test_get_entry_and_section_type(
@ -373,14 +373,14 @@ def test_get_entry_and_section_type(
entry = request.getfixturevalue(entry)
entry_type, section_type = dm.get_entry_and_section_type(entry)
assert entry_type == expected_entry_type
assert section_type == expected_section_type
assert section_type.__name__ == expected_section_type
# initialize the entry with the entry type
if not entry_type == "TextEntry":
if entry_type != "TextEntry":
entry = eval(f"dm.{entry_type}(**entry)")
entry_type, section_type = dm.get_entry_and_section_type(entry)
assert entry_type == expected_entry_type
assert section_type == expected_section_type
assert section_type.__name__ == expected_section_type
def test_sections(

View File

@ -240,20 +240,20 @@ def test_invalid_divide_length_by(length, divider):
def test_get_an_item_with_a_specific_attribute_value():
entry_objects = [
dm.OneLineEntry(
name="Test1",
label="Test1",
details="Test2",
),
dm.OneLineEntry(
name="Test3",
label="Test3",
details="Test4",
),
]
result = r.get_an_item_with_a_specific_attribute_value(
entry_objects, "name", "Test3"
entry_objects, "label", "Test3"
)
assert result == entry_objects[1]
result = r.get_an_item_with_a_specific_attribute_value(
entry_objects, "name", "DoesntExist"
entry_objects, "label", "DoesntExist"
)
assert result is None