Skip to content

Commit

Permalink
Track coverage of properties and dunder methods (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed May 19, 2024
1 parent 598731d commit 61ba6df
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 54 deletions.
442 changes: 408 additions & 34 deletions betty/tests/coverage/test_coverage.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions betty/tests/model/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ async def test_delitem_by_entity_id(self) -> None:

assert [entity1, entity3] == list(sut)

async def test_contains_by_entity(self) -> None:
async def test___contains___by_entity(self) -> None:
sut = SingleTypeEntityCollection[Entity](Entity)
entity1 = SingleTypeEntityCollectionTestEntity()
entity2 = SingleTypeEntityCollectionTestEntity()
Expand All @@ -322,7 +322,7 @@ async def test_contains_by_entity(self) -> None:
assert entity1 in sut
assert entity2 not in sut

async def test_contains_by_entity_id(self) -> None:
async def test___contains___by_entity_id(self) -> None:
sut = SingleTypeEntityCollection[Entity](Entity)
entity1 = SingleTypeEntityCollectionTestEntity()
entity2 = SingleTypeEntityCollectionTestEntity()
Expand All @@ -339,7 +339,7 @@ async def test_contains_by_entity_id(self) -> None:
[],
],
)
async def test_contains_by_unsupported_typed(self, value: Any) -> None:
async def test___contains___by_unsupported_typed(self, value: Any) -> None:
sut = SingleTypeEntityCollection[Entity](Entity)
entity = SingleTypeEntityCollectionTestEntity()
sut.add(entity)
Expand Down Expand Up @@ -530,7 +530,7 @@ async def test_contain_by_entity(self) -> None:
[],
],
)
async def test_contains_by_unsupported_type(self, value: Any) -> None:
async def test___contains___by_unsupported_type(self, value: Any) -> None:
sut = MultipleTypesEntityCollection[Entity]()
entity = MultipleTypesEntityCollectionTestEntityOne()
sut.add(entity)
Expand Down
4 changes: 2 additions & 2 deletions betty/tests/model/test_ancestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,10 +1161,10 @@ class TestPlaceName:
(False, PlaceName(name="Ikke"), "not-a-place-name"),
],
)
async def test_eq(self, expected: bool, a: PlaceName, b: Any) -> None:
async def test___eq__(self, expected: bool, a: PlaceName, b: Any) -> None:
assert expected == (a == b)

async def test_str(self) -> None:
async def test___str__(self) -> None:
name = "Ikke"
sut = PlaceName(name=name)
assert name == str(sut)
Expand Down
2 changes: 1 addition & 1 deletion betty/tests/serde/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def test_with_context(self) -> None:


class TestSerdeErrorCollection:
async def test_localizewithout_errors(self) -> None:
async def test_localize_without_errors(self) -> None:
sut = SerdeErrorCollection()
assert "" == sut.localize(DEFAULT_LOCALIZER)

Expand Down
2 changes: 1 addition & 1 deletion betty/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def test_len(self) -> None:
)
assert 2 == len(sut)

async def test_eq(self) -> None:
async def test___eq__(self) -> None:
configurations = self.get_configurations()
sut = self.get_sut(
[
Expand Down
16 changes: 8 additions & 8 deletions betty/tests/test_locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def test_in(self, expected: bool, other: Datey) -> None:
(True, Date(1970, 3)),
],
)
async def test_lt(self, expected: bool, other: Datey) -> None:
async def test___lt__(self, expected: bool, other: Datey) -> None:
assert expected == (Date(1970, 2, 2) < other)

@pytest.mark.parametrize(
Expand All @@ -171,7 +171,7 @@ async def test_lt(self, expected: bool, other: Datey) -> None:
(False, None),
],
)
async def test_eq(self, expected: bool, other: Datey) -> None:
async def test___eq__(self, expected: bool, other: Datey) -> None:
assert expected == (Date(1970, 1, 1) == other)
assert expected == (other == Date(1970, 1, 1))

Expand All @@ -183,7 +183,7 @@ async def test_eq(self, expected: bool, other: Datey) -> None:
(False, Date(1970, 2, 3)),
],
)
async def test_gt(self, expected: bool, other: Datey) -> None:
async def test___gt__(self, expected: bool, other: Datey) -> None:
assert expected == (Date(1970, 2, 2) > other)


Expand Down Expand Up @@ -286,7 +286,7 @@ async def test_in(self, expected: bool, other: Datey, sut: Datey) -> None:
(False, DateRange(Date(1970, 2, 1), Date(1970, 2, 3))),
],
)
async def test_lt_with_start_date(self, expected: bool, other: Datey) -> None:
async def test___lt___with_start_date(self, expected: bool, other: Datey) -> None:
assert expected == (DateRange(Date(1970, 2, 2)) < other)

@pytest.mark.parametrize(
Expand All @@ -306,7 +306,7 @@ async def test_lt_with_start_date(self, expected: bool, other: Datey) -> None:
(False, DateRange(Date(1970, 2, 1), Date(1970, 2, 3))),
],
)
async def test_lt_with_end_date(self, expected: bool, other: Datey) -> None:
async def test___lt___with_end_date(self, expected: bool, other: Datey) -> None:
assert expected == (DateRange(None, Date(1970, 2, 2)) < other)

@pytest.mark.parametrize(
Expand All @@ -327,7 +327,7 @@ async def test_lt_with_end_date(self, expected: bool, other: Datey) -> None:
(False, DateRange(Date(1970, 2, 1), Date(1970, 2, 3))),
],
)
async def test_lt_with_both_dates(self, expected: bool, other: Datey) -> None:
async def test___lt___with_both_dates(self, expected: bool, other: Datey) -> None:
assert expected == (DateRange(Date(1970, 2, 1), Date(1970, 2, 3)) < other)

@pytest.mark.parametrize(
Expand All @@ -343,7 +343,7 @@ async def test_lt_with_both_dates(self, expected: bool, other: Datey) -> None:
(False, None),
],
)
async def test_eq(self, expected: bool, other: Datey) -> None:
async def test___eq__(self, expected: bool, other: Datey) -> None:
assert expected == (DateRange(Date(1970, 2, 2)) == other)

@pytest.mark.parametrize(
Expand All @@ -363,7 +363,7 @@ async def test_eq(self, expected: bool, other: Datey) -> None:
(True, DateRange(Date(1970, 2, 1), Date(1970, 2, 3))),
],
)
async def test_gt(self, expected: bool, other: Datey) -> None:
async def test___gt__(self, expected: bool, other: Datey) -> None:
assert expected == (DateRange(Date(1970, 2, 2)) > other)


Expand Down
6 changes: 3 additions & 3 deletions betty/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def test_invalid_alias(self) -> None:
),
],
)
async def test_eq(
async def test___eq__(
self, expected: bool, sut: LocaleConfiguration, other: Any
) -> None:
assert expected == (sut == other)
Expand Down Expand Up @@ -413,7 +413,7 @@ async def test_configuration(self) -> None:
),
],
)
async def test_eq(
async def test___eq__(
self, expected: bool, one: ExtensionConfiguration, other: ExtensionConfiguration
) -> None:
assert expected == (one == other)
Expand Down Expand Up @@ -577,7 +577,7 @@ async def test_dump_with_generate_html_list(self) -> None:
),
],
)
async def test_eq(
async def test___eq__(
self,
expected: bool,
one: EntityTypeConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion betty/tests/test_wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ async def test_content(self) -> None:
),
],
)
async def test_eq(self, expected: bool, left: Summary, right: object) -> None:
async def test___eq__(self, expected: bool, left: Summary, right: object) -> None:
assert (left == right) is expected


Expand Down

0 comments on commit 61ba6df

Please sign in to comment.