@pytest.fixture
def mock_message_thread_builder(mock_message_builder, mock_profile_builder):
    counter = itertools.count()
    next(counter)

    def _build_mock_message_thread(id=None, message_count=2,
                                   initiator='initiator',
                                   respondent='respondent', **kwargs):
        if id is None:
            id = next(counter)
        messages = [mock_message_builder(content='{0}'.format(i),
                                         sender=respondent
                                         if i % 2 else initiator,
                                         recipient=initiator
                                         if 2 % i else respondent)
                    for i in range(message_count)]
        kwargs.setdefault('datetime',
                          datetime.datetime(year=2014, day=2, month=4))
        message_thread = mock.MagicMock(id=id, messages=messages, **kwargs)
        message_thread.initiator = mock_profile_builder(initiator)
        message_thread.respondent = mock_profile_builder(respondent)
        return message_thread
    return _build_mock_message_thread
dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd_testing/conftest.py/mock_message_thread_builder/swapped operands of `%`