Skip to content

Commit

Permalink
fix: output str
Browse files Browse the repository at this point in the history
  • Loading branch information
Lundez committed Aug 2, 2023
1 parent 9574a79 commit a3ff311
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unit/slider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ def get_tick_labels(clazz, min, max, step, **kwargs) -> list:

def test_int_slider():
reference_ticks = [3, 4, 5]
assert get_tick_labels(solara.IntSlider, 3, 5, 1) == [3, None, 5]
assert get_tick_labels(solara.IntSlider, 3, 5, 1) == ["3", None, "5"]
assert get_tick_labels(solara.IntSlider, 3, 5, 1, tick_labels=None) == [None] * len(reference_ticks)
assert get_tick_labels(solara.IntSlider, 3, 5, 1, tick_labels=reference_ticks) == reference_ticks
assert get_tick_labels(solara.IntSlider, 3, 5, 1, tick_labels=reference_ticks) == map(str, reference_ticks)


def test_float_slider():
reference_ticks = [3, 3.5, 4, 4.5, 5]
middle_nones = [None] * (len(reference_ticks) - 2)
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.5) == [3, *middle_nones, 5]
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.5) == ["3", *middle_nones, "5"]
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.5, tick_labels=None) == [None] * len(reference_ticks)
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.5, tick_labels=reference_ticks) == reference_ticks
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.5, tick_labels=reference_ticks) == map(str, reference_ticks)

reference_ticks = [3, 3.3, 3.6, 3.9, 4.2, 4.5, 4.8, 5]
middle_nones = [None] * (len(reference_ticks) - 2)
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.3) == [3, *middle_nones, 5]
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.3) == ["3", *middle_nones, "5"]
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.3, tick_labels=None) == [None] * len(reference_ticks)
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.3, tick_labels=reference_ticks) == reference_ticks
assert get_tick_labels(solara.FloatSlider, 3, 5, 0.3, tick_labels=reference_ticks) == map(str, reference_ticks)

0 comments on commit a3ff311

Please sign in to comment.