code: def test_partition_nested_with_num_shards_specification(self):
      data1 = np.random.randn(10, 4)
      data2 = np.random.randn(10, 4)
      # Reasonable number of shards
      xshards = XShards.partition(
          {"x": (data1,), "y": [data2]}, num_shards=2
      )
  
      data_parts = xshards.rdd.collect()
  
      data1_parts = [part["x"][0] for part in data_parts]
      data2_parts = [part["y"][0] for part in data_parts]
  
      reconstructed1 = np.concatenate(data1_parts)
      reconstructed2 = np.concatenate(data2_parts)
      assert np.allclose(data1, reconstructed1)
      assert np.allclose(data2, reconstructed2)
      # Empty shards
      with pytest.raises(RuntimeError) as errorInfo:
          xshards = XShards.partition(
              {"x": (data1,), "y": [data2]}, num_shards=20
          )
  
      assert errorInfo.type == RuntimeError
      assert "number of shards" in str(errorInfo.value)
  
file_path: BigDL/python/orca/test/bigdl/orca/data/test_xshards_partition.py
imports: from unittest import TestCase
  import pytest
  import numpy
  from bigdl.orca.data import XShards
label_desc: Use image node_id 7 for calling the TestXshardsPartition obj's underlying member method code with example usage: obj.test_partition_nested_with_num_shards_specification() without return types