code: def test_from_splits(self):
      data = Reader().read("./tests/data.txt")
      try:
          BaseMethod.from_splits(train_data=None, test_data=None)
      except ValueError:
          assert True
  
      try:
          BaseMethod.from_splits(train_data=data, test_data=None)
      except ValueError:
          assert True
  
      try:
          BaseMethod.from_splits(
              train_data=data, test_data=[], exclude_unknowns=True
          )
      except ValueError:
          assert True
  
      bm = BaseMethod.from_splits(
          train_data=data[:-1], test_data=data[-1:]
      )
      self.assertEqual(bm.total_users, 10)
      self.assertEqual(bm.total_items, 10)
  
      bm = BaseMethod.from_splits(
          train_data=data[:-1],
          test_data=data[-1:],
          val_data=[(data[0][0], data[1][1], 5.0)],
          verbose=True,
      )
      self.assertEqual(bm.total_users, 10)
      self.assertEqual(bm.total_items, 10)
  
file_path: cornac/tests/cornac/eval_methods/test_base_method.py
imports: import unittest
  from cornac.eval_methods import BaseMethod
  from cornac.data import FeatureModality, TextModality, ReviewModality, ImageModality, SentimentModality
  from cornac.data import Dataset, Reader
  from cornac.metrics import MAE, AUC
  from cornac.models import MF
label_desc: Use image node_id 4 for calling the TestBaseMethod obj's underlying member method code with example usage: obj.test_from_splits() without return types