code: def test_batch_norm_macro(dnn):
      if not dnn:
          from lasagne.layers import BatchNormLayer, batch_norm
      else:
          try:
              from lasagne.layers.dnn import (
                  BatchNormDNNLayer as BatchNormLayer,
                  batch_norm_dnn as batch_norm,
              )
          except ImportError:
              pytest.skip("cuDNN batch norm not available")
      from lasagne.layers import Layer, NonlinearityLayer
      from lasagne.nonlinearities import identity
  
      input_shape = (2, 3)
      obj = object()
  
      # check if it steals the nonlinearity
      layer = Mock(Layer, output_shape=input_shape, nonlinearity=obj)
      bnstack = batch_norm(layer)
      assert isinstance(bnstack, NonlinearityLayer)
      assert isinstance(bnstack.input_layer, BatchNormLayer)
      assert layer.nonlinearity is identity
      assert bnstack.nonlinearity is obj
  
      # check if it removes the bias
      layer = Mock(
          Layer, output_shape=input_shape, b=obj, params={obj: set()}
      )
      bnstack = batch_norm(layer)
      assert isinstance(bnstack, BatchNormLayer)
      assert layer.b is None
      assert obj not in layer.params
  
      # check if it can handle an unset bias
      layer = Mock(
          Layer, output_shape=input_shape, b=None, params={obj: set()}
      )
      bnstack = batch_norm(layer)
      assert isinstance(bnstack, BatchNormLayer)
      assert layer.b is None
  
      # check if it passes on kwargs
      layer = Mock(Layer, output_shape=input_shape)
      bnstack = batch_norm(layer, name="foo")
      assert isinstance(bnstack, BatchNormLayer)
      assert bnstack.name == "foo"
  
      # check if created layers are named with kwargs name
      layer = Mock(Layer, output_shape=input_shape, nonlinearity=obj)
      layer.name = "foo"
      bnstack = batch_norm(layer, name="foo_bnorm")
      assert isinstance(bnstack, NonlinearityLayer)
      assert isinstance(bnstack.input_layer, BatchNormLayer)
      assert bnstack.name == "foo_bnorm_nonlin"
      assert bnstack.input_layer.name == "foo_bnorm"
  
      # check if created layers are named with wrapped layer name
      layer = Mock(Layer, output_shape=input_shape, nonlinearity=obj)
      layer.name = "foo"
      bnstack = batch_norm(layer)
      assert isinstance(bnstack, NonlinearityLayer)
      assert isinstance(bnstack.input_layer, BatchNormLayer)
      assert bnstack.name == "foo_bn_nonlin"
      assert bnstack.input_layer.name == "foo_bn"
  
      # check if created layers remain unnamed if no names are given
      layer = Mock(Layer, output_shape=input_shape, nonlinearity=obj)
      bnstack = batch_norm(layer)
      assert isinstance(bnstack, NonlinearityLayer)
      assert isinstance(bnstack.input_layer, BatchNormLayer)
      assert bnstack.name is None
      assert bnstack.input_layer.name is None
  
imports: from mock import Mock
  import numpy
  import pytest
  import theano
label_desc: Use image node_id 3 for calling a global function with example usage: test_batch_norm_macro(dnn) without return types