code: def test_module_must_be_last():
      """Make sure that the pipeline is invalid if CreateBatchFiles is not last"""
      #
      # First, make sure that a naked CPModule tests valid
      #
      pipeline = cellprofiler_core.pipeline.Pipeline()
      module = cellprofiler_core.module.Module()
      module.set_module_num(len(pipeline.modules()) + 1)
      pipeline.add_module(module)
      pipeline.test_valid()
      #
      # Make sure that CreateBatchFiles on its own tests valid
      #
      pipeline = cellprofiler_core.pipeline.Pipeline()
      module = cellprofiler.modules.createbatchfiles.CreateBatchFiles()
      module.set_module_num(len(pipeline.modules()) + 1)
      pipeline.add_module(module)
      pipeline.test_valid()
  
      module = cellprofiler_core.module.Module()
      module.set_module_num(len(pipeline.modules()) + 1)
      pipeline.add_module(module)
      with pytest.raises(cellprofiler_core.setting.ValidationError):
          pipeline.test_valid()
  
file_path: CellProfiler/tests/frontend/modules/test_createbatchfiles.py
imports: import sys
  import pytest
  import six.moves
  import cellprofiler_core.module
  import cellprofiler.modules.createbatchfiles
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import tests.frontend.modules
label_desc: Use image node_id 4 for calling a global function with example usage: test_module_must_be_last() without return types