code: def collect(self):
          
  
          self.nb = nbformat.read(str(self.fspath), as_version=4)
  
          # Start the cell count
          cell_num = 0
  
          # Iterate over the cells in the notebook
          for cell in self.nb.cells:
              # Skip the cells that have text, headings or related stuff
              # Only test code cells
              if cell.cell_type == 'code':
                  # The cell may contain a comment indicating that its output
                  # should be checked or ignored. If it doesn't, use the default
                  # behaviour. The --nbval option checks unmarked cells.
                  with warnings.catch_warnings(record=True) as ws:
                      options = defaultdict(bool, find_metadata_tags(cell.metadata))
                      comment_opts = dict(find_comment_markers(cell.source))
                      if set(comment_opts.keys()) & set(options.keys()):
                          warnings.warn(
                              "Overlapping options from comments and metadata, "
                              "using options from comments: %s" %
                              str(set(comment_opts.keys()) & set(options.keys())))
                      for w in ws:
                          self.parent.config.warn(
                              "C1",
                              str(w.message),
                              '%s:Cell %d' % (
                                  getattr(self, "fspath", None),
                                  cell_num))
                  options.update(comment_opts)
                  options.setdefault('check', self.compare_outputs)
                  yield IPyNbCell('Cell ' + str(cell_num), self, cell_num,
                                  cell, options)
  
                  # Update 'code' cell count
                  cell_num += 1
docs: The collect function is required by pytest and is used to yield pytest
          Item objects. We specify an Item for each code cell in the notebook.