Skip to content

Commit

Permalink
Merge pull request #5519 from TomJGooding/test-add-missing-assertions…
Browse files Browse the repository at this point in the history
…-to-snapshot-tests

test: add missing assertions to snapshot tests
  • Loading branch information
willmcgugan authored Feb 13, 2025
2 parents 80ea233 + d4be018 commit 4aac6eb
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ def render(self) -> LinearGradient:
return LinearGradient(30.0, stops)

app = TransparentApp()
snap_compare(app)
assert snap_compare(app)


def test_maximize_allow(snap_compare):
Expand Down Expand Up @@ -2888,7 +2888,7 @@ async def run_before(pilot: Pilot) -> None:
await pilot.pause()
await pilot.click("Select")

snap_compare(TallSelectApp(), run_before=run_before)
assert snap_compare(TallSelectApp(), run_before=run_before)


def test_markup_command_list(snap_compare):
Expand All @@ -2908,7 +2908,7 @@ def on_mount(self) -> None:
]
)

snap_compare(MyApp())
assert snap_compare(MyApp())


def test_app_resize_order(snap_compare):
Expand Down Expand Up @@ -2950,7 +2950,7 @@ def on_mount(self) -> None:
def on_resize(self) -> None:
self.add_class("narrow")

snap_compare(SCApp())
assert snap_compare(SCApp())


def test_add_remove_tabs(snap_compare):
Expand Down Expand Up @@ -2981,7 +2981,7 @@ def action_add_pane(self) -> None:
new_pane = TabPane("New tab", Label("new"))
tabbed_content.add_pane(new_pane)

snap_compare(ExampleApp(), press=["a", "r", "a"])
assert snap_compare(ExampleApp(), press=["a", "r", "a"])


def test_click_expand(snap_compare):
Expand All @@ -2998,7 +2998,7 @@ async def run_before(pilot: Pilot) -> None:
await pilot.pause()
await pilot.click(Select)

snap_compare(SelectApp(), run_before=run_before)
assert snap_compare(SelectApp(), run_before=run_before)


def test_disable_command_palette(snap_compare):
Expand All @@ -3019,7 +3019,7 @@ def check_action(
return None
return True

snap_compare(FooterApp())
assert snap_compare(FooterApp())


def test_selection_list_wrap(snap_compare):
Expand All @@ -3029,7 +3029,7 @@ class SelectionListApp(App):
def compose(self) -> ComposeResult:
yield SelectionList(("Hello World " * 100, 0))

snap_compare(SelectionListApp())
assert snap_compare(SelectionListApp())


def test_border_tab(snap_compare):
Expand All @@ -3054,7 +3054,7 @@ def compose(self) -> ComposeResult:
label.border_subtitle = ":-)"
yield label

snap_compare(TabApp())
assert snap_compare(TabApp())


def test_dock_align(snap_compare):
Expand Down Expand Up @@ -3126,7 +3126,7 @@ class Test1(App):
def compose(self):
yield MainContainer()

snap_compare(Test1())
assert snap_compare(Test1())


def test_auto_parent_with_alignment(snap_compare):
Expand Down Expand Up @@ -3163,7 +3163,7 @@ class FloatSidebarApp(App):
def compose(self) -> ComposeResult:
yield Sidebar()

snap_compare(FloatSidebarApp())
assert snap_compare(FloatSidebarApp())


def test_select_refocus(snap_compare):
Expand Down Expand Up @@ -3207,7 +3207,7 @@ def compose(self):
with Container():
yield MyListView()

snap_compare(TUI(), press=["down", "enter", "down", "down", "enter"])
assert snap_compare(TUI(), press=["down", "enter", "down", "down", "enter"])


def test_widgets_in_grid(snap_compare):
Expand Down Expand Up @@ -3243,7 +3243,7 @@ def compose(self) -> ComposeResult:
label.border_title = str(n)
yield label

snap_compare(MyApp(), terminal_size=(100, 50))
assert snap_compare(MyApp(), terminal_size=(100, 50))


def test_arbitrary_selection(snap_compare):
Expand Down Expand Up @@ -3296,7 +3296,7 @@ def on_mount(self) -> None:
for number in range(1, 100):
t1.add_row(str(number) + " " * 200)

snap_compare(MyApp())
assert snap_compare(MyApp())


def test_scrollbar_background_with_opacity(snap_compare):
Expand Down Expand Up @@ -3342,7 +3342,7 @@ def compose(self) -> ComposeResult:
yield Label("This allows [bold]markup[/bold]")
yield Label("This does not allow [bold]markup[/bold]", markup=False)

snap_compare(LabelApp())
assert snap_compare(LabelApp())


def test_arbitrary_selection_double_cell(snap_compare):
Expand Down Expand Up @@ -3447,7 +3447,7 @@ class OptionListAutoCrash(App[None]):
def compose(self) -> ComposeResult:
yield OptionList()

snap_compare(OptionListAutoCrash())
assert snap_compare(OptionListAutoCrash())


def test_focus_within_transparent(snap_compare):
Expand Down Expand Up @@ -3491,7 +3491,7 @@ def compose(self) -> ComposeResult:
yield OptionList(*["This is an option" for _ in range(30)])
yield Input(placeholder="Escape out via here for the bug")

snap_compare(FocusWithinTransparentApp(), press=["tab"])
assert snap_compare(FocusWithinTransparentApp(), press=["tab"])


def test_option_list_wrapping(snap_compare):
Expand All @@ -3511,7 +3511,7 @@ def compose(self) -> ComposeResult:
"This is a very long option that is too wide to fit within the space provided and will overflow."
)

snap_compare(OLApp())
assert snap_compare(OLApp())


def test_add_separator(snap_compare):
Expand Down Expand Up @@ -3549,7 +3549,7 @@ async def run_before(pilot: Pilot) -> None:
await pilot.click(Button)
await pilot.pause(0.4)

snap_compare(FocusTest(), run_before=run_before)
assert snap_compare(FocusTest(), run_before=run_before)


def test_visual_tooltip(snap_compare):
Expand All @@ -3576,4 +3576,4 @@ async def run_before(pilot: Pilot) -> None:
await pilot.pause(0.4)
await pilot.pause()

snap_compare(TooltipApp(), run_before=run_before)
assert snap_compare(TooltipApp(), run_before=run_before)

0 comments on commit 4aac6eb

Please sign in to comment.