code: def test_cardinality():
      with tfds.testing.mock_data(num_examples=8):
          ds = tfds.load("mnist", split="train")
          assert ds.cardinality().numpy().item() == 8
  
      with tfds.testing.mock_data(num_examples=15):
          ds = tfds.load("mnist", split="train")
          assert ds.cardinality().numpy().item() == 15
  
imports: import functools
  import pickle
  import numpy
  import pytest
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 14 for calling a global function with example usage: test_cardinality() without return types