Skip to content

Commit

Permalink
Fix missing utf-8 decoding in tests (#6641)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and ahuang11 committed Apr 2, 2024
1 parent d3cebfa commit 04e7776
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
10 changes: 2 additions & 8 deletions panel/pane/_textual.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@

class PanelDriver(Driver):

def __init__(
self,
app: App,
*,
debug: bool = False,
size: tuple[int, int] | None = None
) -> None:
super().__init__(app, debug=debug, size=size)
def __init__(self, app: App, /, **kwargs) -> None:
super().__init__(app, **kwargs)
self._terminal = app.__panel__._terminal
self._input_initialized = False
self._input_watcher = None
Expand Down
2 changes: 1 addition & 1 deletion panel/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def is_panel_pane(attr):
def find_indexed(index):
indexed = []
toctree = False
for line in index.read_text().split('\n'):
for line in index.read_text(encoding="utf-8").split('\n'):
if line == '```{toctree}':
toctree = True
elif not toctree:
Expand Down
4 changes: 2 additions & 2 deletions panel/tests/ui/layout/test_accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def accordion_components():


def is_collapsed(card_object, card_content):
expect(card_object).to_contain_text("\u25ba")
expect(card_object.locator('svg')).to_have_class("icon icon-tabler icons-tabler-outline icon-tabler-chevron-right")
expect(card_object).not_to_contain_text(card_content)
return True


def is_expanded(card_object, card_content):
expect(card_object).to_contain_text("\u25bc")
expect(card_object.locator('svg')).to_have_class("icon icon-tabler icons-tabler-outline icon-tabler-chevron-down")
expect(card_object).to_contain_text(card_content)
return True

Expand Down
7 changes: 3 additions & 4 deletions panel/tests/ui/layout/test_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def test_card_default(page, card_components):

# icon display in card button in expanded mode
card_button = page.locator('.card-button')
button_name = card_button.inner_text()
assert button_name == "\u25bc"
expect(card_button.locator('svg')).to_have_class("icon icon-tabler icons-tabler-outline icon-tabler-chevron-down")


def test_card_collapsed(page, card_components):
Expand All @@ -52,15 +51,15 @@ def test_card_collapsed(page, card_components):
# collapse the card
card_button.wait_for()
card_button.click()
assert card_button.inner_text() == "\u25ba"
expect(card_button.locator('svg')).to_have_class("icon icon-tabler icons-tabler-outline icon-tabler-chevron-right")
# only show the card header, other elements are hidden
expect(card_elements).to_have_count(1)

# expand the card again
card_button.wait_for()
card_button.click()
expect(card_elements).to_have_count(len(card) + 1)
assert card_button.inner_text() == "\u25bc"
expect(card_button.locator('svg')).to_have_class("icon icon-tabler icons-tabler-outline icon-tabler-chevron-down")


def test_card_not_collapsible(page, card_components):
Expand Down

0 comments on commit 04e7776

Please sign in to comment.