Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Jan 31, 2024
1 parent 48f0407 commit 18b45b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions iommi/style__tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class TestTable(Table):
foo = Column.boolean()

verify_table_html(
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='base'),
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='base', attrs__class__table=True),
# language=html
expected_html="""
<table class="table" data-endpoint="/endpoints/tbody" data-iommi-id="">
Expand All @@ -804,7 +804,7 @@ class TestTable(Table):
)

verify_table_html(
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='bulma'),
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='bulma', attrs__class__table=True),
# language=html
expected_html="""
<table class="is-fullwidth is-hoverable table" data-endpoint="/endpoints/tbody" data-iommi-id="">
Expand All @@ -823,7 +823,7 @@ class TestTable(Table):
)

verify_table_html(
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='bootstrap5'),
table=TestTable(rows=(x for x in [Struct(foo=True)]), iommi_style='bootstrap5', attrs__class__table=True),
# language=html
expected_html="""
<table class="table table-sm" data-endpoint="/endpoints/tbody" data-iommi-id="">
Expand Down
3 changes: 2 additions & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ def verify_html(*, actual_html: str, find=None, expected_html: str = None):
actual_soup = BeautifulSoup(actual_html, 'html.parser')

if find is not None:
actual_soup_orig = actual_soup
actual_soup = actual_soup.find(**find)
if not actual_soup: # pragma: no cover
prettied_actual = reindent(actual_soup.prettify()).strip()
prettied_actual = reindent(actual_soup_orig.prettify()).strip()
print(prettied_actual)
assert False, f"Couldn't find selector {find} in actual output"

Expand Down

0 comments on commit 18b45b0

Please sign in to comment.