-2

From here:

from hypothesis import given, strategies as st @given(seq=st.one_of(st.binary(), st.binary().map(bytearray), st.lists(st.integers()))) def test_idempotent_timsort(seq): result = timsort(seq=seq) repeat = timsort(seq=result) assert result == repeat, (result, repeat) 

What does the last assert mean? I understand result == repeat but what's the rest?

1

1 Answer 1

3

The second "argument" to assert is the message printed out if the assertion fails. The idea here is to be able to easily see the expected and actual value for debugging, especially since hypothesis here will generate a whole bunch of tests.

>>> a = 1 >>> b = 2 >>> assert a == b, (a, b) Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError: (1, 2) >>> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.