docstr: Check filtering of one URL using the module as configured
docstr_tok: ["Check","filtering","of","one","URL","using","the","module","as","configured"]
code: def check(self, module, url, expected, extract=False):
      """Check filtering of one URL using the module as configured"""
      pipeline = cellprofiler_core.pipeline.Pipeline()
      pipeline.add_urls([url])
      module.set_module_num(1)
      pipeline.add_module(module)
      m = cellprofiler_core.measurement.Measurements()
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline, module, None, None, m, None
      )
      file_list = pipeline.get_filtered_file_list(workspace)
      if expected:
          assert len(file_list) == 1
          assert file_list[0].url == url
      else:
          assert len(file_list) == 0
      if extract:
          # When not in the GUI pipeline and workspace are disconnected.
          # Since we're manually extracting metadata we'll keep them aligned.
          hdf5_list = workspace.file_list
          true_file_list = hdf5_list.get_filelist()
          assert len(true_file_list) == len(file_list) == 1
          assert true_file_list[0] == file_list[0].url
          file_object = file_list[0]
          assert not file_object.extracted
          old_meta, series_names = hdf5_list.get_metadata(url)
          assert all([x == -1 for x in old_meta])
          assert series_names == [""]
          module.prepare_run(workspace)
          assert file_object.extracted
          plane_meta = file_object.metadata
          assert plane_meta["SizeS"] == 1
          expected_meta = [3, 1, 1, 21, 31]
          plane_metadata = [
              plane_meta[k][0]
              for k in ("SizeC", "SizeZ", "SizeT", "SizeY", "SizeX")
          ]
          stored_metadata, stored_names = hdf5_list.get_metadata(url)
          assert len(stored_metadata) == len(expected_meta)
          assert len(stored_names) == len(expected_meta) // 5
          for expected, obj, hdf5 in zip(
              expected_meta, plane_metadata, stored_metadata
          ):
              assert expected == obj == hdf5
  
imports: import io
  import os
  import tempfile
  import cellprofiler_core.constants.modules.images
  import cellprofiler_core.measurement
  import cellprofiler_core.pipeline
  import cellprofiler_core.pipeline.event._load_exception
  import cellprofiler_core.workspace
  import cellprofiler_core.modules.images
  import cellprofiler_core.modules.metadata
  from cellprofiler_core.utilities.pathname import url2pathname, pathname2url
  import tests.core
label_desc: Use image node_id 7 for calling the TestImages obj's underlying member method code with example usage: obj.check(module, url, expected, extract) without return types