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 = { one_line_entry_dictionary = {
"name": "Programming", "label": "Programming",
"details": "Python, C++, JavaScript, MATLAB", "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), ("invalid_start_date", "2021-01-01", None),
("2020-99-99", "2021-01-01", None), ("2020-99-99", "2021-01-01", None),
("2020-10-12", "2020-99-99", 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): def test_invalid_dates(start_date, end_date, date):
@ -346,25 +346,25 @@ def test_social_network_url(network, username, expected_url):
( (
"publication_entry", "publication_entry",
"PublicationEntry", "PublicationEntry",
dm.SectionWithPublicationEntries, "SectionWithPublicationEntries",
), ),
( (
"experience_entry", "experience_entry",
"ExperienceEntry", "ExperienceEntry",
dm.SectionWithExperienceEntries, "SectionWithExperienceEntries",
), ),
( (
"education_entry", "education_entry",
"EducationEntry", "EducationEntry",
dm.SectionWithEducationEntries, "SectionWithEducationEntries",
), ),
( (
"normal_entry", "normal_entry",
"NormalEntry", "NormalEntry",
dm.SectionWithNormalEntries, "SectionWithNormalEntries",
), ),
("one_line_entry", "OneLineEntry", dm.SectionWithOneLineEntries), ("one_line_entry", "OneLineEntry", "SectionWithOneLineEntries"),
("text_entry", "TextEntry", dm.SectionWithTextEntries), ("text_entry", "TextEntry", "SectionWithTextEntries"),
], ],
) )
def test_get_entry_and_section_type( def test_get_entry_and_section_type(
@ -373,14 +373,14 @@ def test_get_entry_and_section_type(
entry = request.getfixturevalue(entry) entry = request.getfixturevalue(entry)
entry_type, section_type = dm.get_entry_and_section_type(entry) entry_type, section_type = dm.get_entry_and_section_type(entry)
assert entry_type == expected_entry_type 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 # initialize the entry with the entry type
if not entry_type == "TextEntry": if entry_type != "TextEntry":
entry = eval(f"dm.{entry_type}(**entry)") entry = eval(f"dm.{entry_type}(**entry)")
entry_type, section_type = dm.get_entry_and_section_type(entry) entry_type, section_type = dm.get_entry_and_section_type(entry)
assert entry_type == expected_entry_type assert entry_type == expected_entry_type
assert section_type == expected_section_type assert section_type.__name__ == expected_section_type
def test_sections( 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(): def test_get_an_item_with_a_specific_attribute_value():
entry_objects = [ entry_objects = [
dm.OneLineEntry( dm.OneLineEntry(
name="Test1", label="Test1",
details="Test2", details="Test2",
), ),
dm.OneLineEntry( dm.OneLineEntry(
name="Test3", label="Test3",
details="Test4", details="Test4",
), ),
] ]
result = r.get_an_item_with_a_specific_attribute_value( result = r.get_an_item_with_a_specific_attribute_value(
entry_objects, "name", "Test3" entry_objects, "label", "Test3"
) )
assert result == entry_objects[1] assert result == entry_objects[1]
result = r.get_an_item_with_a_specific_attribute_value( result = r.get_an_item_with_a_specific_attribute_value(
entry_objects, "name", "DoesntExist" entry_objects, "label", "DoesntExist"
) )
assert result is None assert result is None