Skip to content

Commit

Permalink
Fix tests for metaformats transition to meta-item property
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelo Gladding committed Dec 4, 2023
1 parent 9982662 commit 206dede
Showing 1 changed file with 38 additions and 51 deletions.
89 changes: 38 additions & 51 deletions test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,67 +1126,54 @@ def test_all_u_cases():
)


def test_metaformats_flag_false():
result = parse_fixture("metaformats_ogp.html")
assert result["items"] == []


def test_metaformats_title_only():
result = parse_fixture("base.html", metaformats=True)
assert result["items"] == [
{
"type": ["h-entry"],
"properties": {
"name": ["Hello World"],
},
}
]
result = parse_fixture("base.html")
assert result["meta-item"] == {
"type": ["h-entry"],
"properties": {
"name": ["Hello World"],
},
}


def test_metaformats_ogp():
result = parse_fixture("metaformats_ogp.html", metaformats=True)
assert result["items"] == [
{
"type": ["h-entry"],
"properties": {
"name": ["Titull foo"],
"summary": ["Descrypshun bar"],
"photo": ["http://example.com/baz.jpg"],
"audio": ["http://example.com/biff.mp3"],
"video": ["http://example.com/boff.mov"],
"author": ["http://tantek.com/me"],
"published": ["2023-01-02T03:04Z"],
"updated": ["2023-01-02T05:06Z"],
},
}
]
result = parse_fixture("metaformats_ogp.html")
assert result["meta-item"] == {
"type": ["h-entry"],
"properties": {
"name": ["Titull foo"],
"summary": ["Descrypshun bar"],
"photo": ["http://example.com/baz.jpg"],
"audio": ["http://example.com/biff.mp3"],
"video": ["http://example.com/boff.mov"],
"author": ["http://tantek.com/me"],
"published": ["2023-01-02T03:04Z"],
"updated": ["2023-01-02T05:06Z"],
},
}


def test_metaformats_twitter():
result = parse_fixture("metaformats_twitter.html", metaformats=True)
assert result["items"] == [
{
"type": ["h-entry"],
"properties": {
"name": ["Titull foo"],
"summary": ["Descrypshun bar"],
"photo": ["http://tantek.com/baz.jpg"],
},
}
]
result = parse_fixture("metaformats_twitter.html")
assert result["meta-item"] == {
"type": ["h-entry"],
"properties": {
"name": ["Titull foo"],
"summary": ["Descrypshun bar"],
"photo": ["http://tantek.com/baz.jpg"],
},
}


def test_metaformats_html_meta():
result = parse_fixture("metaformats_html_meta.html", metaformats=True)
assert result["items"] == [
{
"type": ["h-entry"],
"properties": {
"name": ["Hello World"],
"summary": ["Descrypshun bar"],
},
}
]
result = parse_fixture("metaformats_html_meta.html")
assert result["meta-item"] == {
"type": ["h-entry"],
"properties": {
"name": ["Hello World"],
"summary": ["Descrypshun bar"],
},
}


def test_language():
Expand Down

0 comments on commit 206dede

Please sign in to comment.