Skip to content

Commit

Permalink
update test_html to compare objects, not files
Browse files Browse the repository at this point in the history
  • Loading branch information
akikuno committed Sep 14, 2022
1 parent 4bad010 commit b652169
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test_to_html.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from pathlib import Path
import filecmp
import tempfile
from src.cstag import to_html


def test_html():
cs = "cs:Z:=AC+GGG=T-ACGT*at~gt10cg=GNNN"
description = "Example"
cs_html = to_html(cs, description)
output = tempfile.NamedTemporaryFile().name
Path(output).write_text(cs_html)
assert filecmp.cmp(output, Path("tests", "data", "to_html", "report.html"))
test = [h for h in cs_html.split("\n") if h.count("<p class='p_seq'>")]
test = test[0].split()
answer = Path("tests", "data", "to_html", "report.html").read_text().split("\n")
answer = [h for h in answer if h.count(r"<p class='p_seq'>")]
answer = answer[0].split()
assert test == answer


def test_html_repeat_substitution():
cs = "cs:Z:=A*at*ag=A"
Expand Down

0 comments on commit b652169

Please sign in to comment.