# 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, reject, strategies as st


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