code: def _test_temporal_order(sequence_users, sequences, interactions):
      interaction_matrix = interactions.tocoo()
      interaction_matrix.data = interactions.timestamps
      interaction_matrix = interaction_matrix.tocsr().todense()
  
      for i, sequence in enumerate(sequences):
          user_id = sequence_users[i]
          nonpadded_sequence = sequence[sequence != 0]
  
          for j in range(0, len(nonpadded_sequence) - 1):
              item_id = nonpadded_sequence[j]
  
              next_item_id = nonpadded_sequence[j + 1]
  
              item_timestamp = interaction_matrix[user_id, item_id]
              next_item_timestamp = interaction_matrix[
                  user_id, next_item_id
              ]
  
              assert item_timestamp <= next_item_timestamp
  
file_path: spotlight/tests/test_interactions.py
imports: import numpy
  import pytest
  from spotlight.cross_validation import random_train_test_split
  from spotlight.datasets import movielens
  from spotlight.interactions import Interactions
label_desc: Use image node_id 4 for calling a global function with example usage: _test_temporal_order(sequence_users, sequences, interactions) without return types