docstr: Assertion method to check :code:`optimizer` input
  
  Raises
  ------
  TypeError
      When :code:`optimizer` does not have an `'optimize'` attribute.
docstr_tok: ["Assertion","method","to","check",":","code",":","`","optimizer","`","input","Raises","--","--","--","TypeError","When",":","code",":","`","optimizer","`","does","not","have","an","`","'optimize","'","`","attribute","."]
code: def assertions(self):
      """Assertion method to check :code:`optimizer` input
  
      Raises
      ------
      TypeError
          When :code:`optimizer` does not have an `'optimize'` attribute.
      """
      # Check type of optimizer object
      if not hasattr(self.optimizer, "optimize"):
          raise TypeError(
              "Parameter `optimizer` must have an "
              "`'optimize'` attribute."
          )
  
file_path: pyswarms/pyswarms/utils/search/base_search.py
imports: from __future__ import absolute_import, print_function, with_statement
  import operator
label_desc: Use image node_id 1 for calling the SearchBase obj's underlying member method code with example usage: obj.assertions() without return types