# This test code was written by the `hypothesis.extra.ghostwriter` module
# and is provided under the Creative Commons Zero public domain dedication.

import collections.abc
import test_expected_output
from hypothesis import given, strategies as st


@given(seq=st.one_of(st.binary(), st.lists(st.integers())))
def test_idempotent_timsort(seq: collections.abc.Sequence[int]) -> None:
    result = test_expected_output.timsort(seq=seq)
    repeat = test_expected_output.timsort(seq=result)
    assert result == repeat, (result, repeat)
