class_docstr: Tests member functions of ClassyDataset. Note, NotImplemented
  functions are mocked in TestDataset class.
class_docstr_tok: ["Tests","member","functions","of","ClassyDataset",".","Note",",","NotImplemented","functions","are","mocked","in","TestDataset","class","."]
code: def test_num_samples_logic(self):
      dataset = TestDataset(DUMMY_SAMPLES_2)
      self.assertEqual(len(dataset), 2)
  
      dataset = TestDataset(DUMMY_SAMPLES_2, num_samples=1)
      # Verify len returns right value for dataset
      self.assertEqual(len(dataset), 1)
      # Verify len returns right value for iterator
      self.assertEqual(len(dataset.iterator(num_workers=0)), 1)
      # Verify iterator returns correct number of samples
      it = iter(dataset.iterator(num_workers=0))
      num_samples = 0
      while True:
          try:
              next(it)
              num_samples += 1
          except StopIteration:
              break
      self.assertEqual(num_samples, 1)
  
      # Check assert for num_samples > length of base dataset
      dataset = TestDataset(DUMMY_SAMPLES_2, num_samples=3)
      with self.assertRaises(AssertionError):
          len(dataset)
  
imports: import multiprocessing
  import unittest
  import unittest.mock
  import classy_vision.dataset.classy_dataset
  import torch
  from classy_vision.dataset import build_dataset, register_dataset
  from classy_vision.dataset.core import ListDataset
  from test.generic.utils import compare_batches, compare_samples
  from torch.utils.data import DataLoader
label_desc: Use image node_id 10 for calling the TestClassyDataset obj's underlying member method code with example usage: obj.test_num_samples_logic() without return types