code: def test_dirichlet_zero_size_dim():
      """Tests for no error when dealing with zero-size array in calculating PDF of Poisson distribution
      Issue: https://github.com/apache/mxnet/issues/18936
      """
  
      def test_valid_zero_dim():
          alpha = mx.nd.array(np.random.rand(0))
          sample = mx.nd.array(np.random.rand(4, 0))
          res = mx.nd.op.random_pdf_dirichlet(
              sample=sample, alpha=alpha
          )
          assert res.shape == sample.shape[:-1]
  
      def test_valid_zero_multi_dim():
          alpha = mx.nd.array(np.random.rand(4, 0))
          sample = mx.nd.array(np.random.rand(4, 3, 0))
          res = mx.nd.op.random_pdf_dirichlet(
              sample=sample, alpha=alpha
          )
          assert res.shape == sample.shape[:-1]
  
      def test_invalid_zero_dim():
          """The shape of *alpha* must match the left-most part of the *sample* shape"""
          alpha = mx.nd.array(np.random.rand(1))
          sample = mx.nd.array(np.random.rand(4, 0))
          assertRaises(
              MXNetError, mx.nd.op.random_pdf_dirichlet, sample, alpha
          )
  
      test_valid_zero_dim()
      test_valid_zero_multi_dim()
      test_invalid_zero_dim()
  
imports: import os
  import math
  import itertools
  import mxnet
  from mxnet.test_utils import verify_generator, gen_buckets_probs_with_ppf, assert_almost_equal
  import numpy
  import random
  from common import retry, random_seed
  import scipy.stats
  import unittest
  import pytest
  from mxnet.test_utils import *
  from mxnet.base import MXNetError
  from common import assertRaises
label_desc: Use image node_id 31 for calling a global function with example usage: test_dirichlet_zero_size_dim() without return types