code: def test_invalid_pull():
      def check_ignored_pull_single(kv, key):
          dns_val = mx.nd.ones(shape) * 2
          rsp_val = dns_val.tostype("row_sparse")
          kv.pull(key, out=rsp_val)
          check_diff_to_scalar(rsp_val, 2)
  
      def check_ignored_pull_list(kv, key):
          dns_val = [mx.nd.ones(shape) * 2] * len(key)
          rsp_val = [val.tostype("row_sparse") for val in dns_val]
          kv.pull(key, out=rsp_val)
          for v in rsp_val:
              check_diff_to_scalar(v, 2)
  
      def check_invalid_rsp_pull_single(kv, key):
          dns_val = mx.nd.ones(shape) * 2
          assertRaises(
              MXNetError,
              kv.row_sparse_pull,
              key,
              out=dns_val,
              row_ids=mx.nd.array([1]),
          )
  
      def check_invalid_rsp_pull_list(kv, key):
          dns_val = [mx.nd.ones(shape) * 2] * len(key)
          assertRaises(
              MXNetError,
              kv.row_sparse_pull,
              key,
              out=dns_val,
              row_ids=[mx.nd.array([1])] * len(key),
          )
  
      def check_invalid_key_types_single(kv, key):
          dns_val = mx.nd.ones(shape) * 2
          rsp_val = dns_val.tostype("row_sparse")
          assertRaises(MXNetError, kv.init, key, dns_val)
          assertRaises(MXNetError, kv.push, key, dns_val)
          assertRaises(MXNetError, kv.pull, key, dns_val)
          assertRaises(
              MXNetError,
              kv.row_sparse_pull,
              key,
              rsp_val,
              row_ids=mx.nd.array([1]),
          )
  
      def check_invalid_key_types_list(kv, key):
          dns_val = [mx.nd.ones(shape) * 2] * len(key)
          rsp_val = [val.tostype("row_sparse") for val in dns_val]
          assertRaises(MXNetError, kv.init, key, dns_val)
          assertRaises(MXNetError, kv.push, key, dns_val)
          assertRaises(MXNetError, kv.pull, key, dns_val)
          assertRaises(
              MXNetError,
              kv.row_sparse_pull,
              key,
              rsp_val,
              row_ids=[mx.nd.array([1])] * len(key),
          )
  
      int_kv = init_kv()
      str_kv = init_kv_with_str()
  
      kvs = [int_kv, str_kv]
      single_keys = [3, "a"]
      list_keys = [keys, str_keys]
      for i in range(2):
          # pull with rsp outputs should be ignored with no values updated
          check_ignored_pull_single(kvs[i], single_keys[i])
          check_ignored_pull_list(kvs[i], list_keys[i])
          # row_sparse_pull should be aborted when vals.stype != row_sparse
          check_invalid_rsp_pull_single(kvs[i], single_keys[i])
          check_invalid_rsp_pull_list(kvs[i], list_keys[i])
          # kvstore should be restricted to only accept either int or str keys
          check_invalid_key_types_single(kvs[i], single_keys[1 - i])
          check_invalid_key_types_list(kvs[i], list_keys[1 - i])
  
imports: import mxnet
  import numpy
  import unittest
  from mxnet.test_utils import rand_ndarray, assert_almost_equal
  from common import assertRaises
  from mxnet.base import py_str, MXNetError
  import pytest
label_desc: Use image node_id 15 for calling a global function with example usage: test_invalid_pull() without return types