Skip to content

Commit

Permalink
fix: Render str types not bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed May 12, 2023
1 parent c8cc154 commit 6e19e9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/atsphinx/og_article/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ def add_metatags(
)
for tag in node["tags"]
]
metatags = b"\n".join([ET.tostring(e) for e in metatags])
metatags = b"\n".join([ET.tostring(e) for e in metatags]).decode()
context["metatags"] += f"\n{metatags}"
8 changes: 7 additions & 1 deletion tests/test_it.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Standard tests."""
from io import StringIO
from pathlib import Path

import pytest
from bs4 import BeautifulSoup
from sphinx.testing.util import SphinxTestApp

from atsphinx.og_article import models
Expand All @@ -10,8 +12,12 @@
@pytest.mark.sphinx("html")
def test__it(app: SphinxTestApp, status: StringIO, warning: StringIO):
"""Test to pass."""
app.builder.read()
app.build()
doctree = app.env.get_doctree("index")
assert doctree is not None
target_nodes = list(doctree.findall(models.og_article))
assert len(target_nodes) == 1
soup = BeautifulSoup(Path(f"{app.outdir}/index.html").read_text(), "html.parser")
assert soup.find("meta", {"property": "article:published_time"})
assert soup.find("meta", {"property": "article:modified_time"})
assert "b'" not in str(soup)

0 comments on commit 6e19e9f

Please sign in to comment.