def _test_shifted(sequence_users, sequences, step_size):
    """
    Unless there was a change of user, row i + 1's interactions
    should contain row i's interactions shifted to the right by
    step size.
    """

    for i in range(1, len(sequences)):

        if sequence_users[i] != sequence_users[i - 1]:
            # Change of user
            continue

        assert np.all(sequences[i][step_size:] == sequences[i - 1][:-step_size])

    Unless there was a change of user, row i + 1's interactions
    should contain row i's interactions shifted to the right by
    step size.
    
tests/test_interactions.py