Skip to content

Commit

Permalink
Add more sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Oct 31, 2024
1 parent 6c2682d commit 11349b2
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions tests/test_ome_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,35 @@ def test_channel_summary() -> None:
assert channel_summary.last_article == last == 0


jane_austen_novels = {
"Sense and Sensibility": 1811,
"Pride and Prejudice": 1813,
"Mansfield Park": 1814,
"Emma": 1816,
"Northanger Abbey": 1818,
"Persuasion": 1819,
"Lady Susan": 1871,
}


def sample_metadata_austin() -> Iterator[ome_node.Metadata]:
for title, year in jane_austen_novels.items():
keyword = title.split()[-1] # "Sense and Sensibility" --> "Sensibility"
yield ome_node.Metadata(
title=title,
url=f"https://en.wikipedia.org/wiki/{title}".replace(" ", "_"),
description=f"{title} is a novel by Jane Austen",
subject="Sensibility",
author="Jane Austen",
alignment_tags=["Sensibility", "Jane Austen", keyword],
keywords=[
"Sensibility",
"Jane Austen",
f"Books from {year}",
],
)


sue_grafton_books = {
"A is for Alibi": 1982,
"B is for Burglar": 1985,
Expand Down Expand Up @@ -75,7 +104,7 @@ def test_channel_summary() -> None:
}


def sample_metadata() -> Iterator[ome_node.Metadata]:
def sample_metadata_boston() -> Iterator[ome_node.Metadata]:
for title, year in sue_grafton_books.items():
keyword = title.split()[-1] # "A is for Alibi" --> "Alibi"
yield ome_node.Metadata(
Expand All @@ -94,7 +123,7 @@ def sample_metadata() -> Iterator[ome_node.Metadata]:
)


@pytest.mark.parametrize("metadata", sample_metadata())
@pytest.mark.parametrize("metadata", sample_metadata_boston())
def test_create_post(metadata: ome_node.Metadata) -> None:
assert isinstance(metadata, ome_node.Metadata)
assert metadata.title in sue_grafton_books
Expand Down

0 comments on commit 11349b2

Please sign in to comment.