code: def test_spec_augment_layer(data_format, atol=1e-4):
      """
      Tests the complete layer, checking if the parameter `training` has the expected behaviour.
      """
  
      batch_src, input_shape = get_spectrogram(data_format)
  
      model = tf.keras.Sequential()
      spec_augment = SpecAugment(
          input_shape=input_shape,
          freq_mask_param=5,
          time_mask_param=10,
          n_freq_masks=4,
          n_time_masks=3,
          mask_value=0.0,
          data_format=data_format,
      )
  
      model.add(spec_augment)
  
      # Fist, enforce training to True and check the shapes
      spec_augmented = model(batch_src, training=True)
      np.testing.assert_equal(
          model.layers[0].output_shape[1:], spec_augmented[0].shape
      )
  
      # Second, check that it doesn't change anything in default
      spec_augmented = model(batch_src)
      np.testing.assert_allclose(spec_augmented, batch_src, atol)
  
file_path: kapre/tests/test_augmentation.py
imports: import pytest
  import numpy
  import tensorflow
  from kapre.augmentation import ChannelSwap, SpecAugment
  from kapre.backend import _CH_FIRST_STR, _CH_LAST_STR, _CH_DEFAULT_STR
  from utils import get_audio, get_spectrogram, save_load_compare
label_desc: Use image node_id 4 for calling a global function with example usage: test_spec_augment_layer(data_format, atol) without return types