parameters: (state, state_checks, cursor)
docstring: Raise an error if state checks can't be passed.
docstring_summary: Raise an error if state checks can't be passed.
docstring_tokens: Raise an error if state checks can t be passed .
function: def check_state(state, state_checks, cursor) -> None:
      """Raise an error if state checks can't be passed."""
      # Skip actual tests if state checking is disabled in state
      if is_disabled(state):
          return
  
      sql_checks = [sc.sql for sc in state_checks]
      args:List = []
      for sc in state_checks:
          args.extend(p for p in sc.params)
  
      if sql_checks:
          cursor.execute("(" + ") INTERSECT (".join(sql_checks) + ")", args)
      else:
          cursor.execute("SELECT 1")
      state_check_results = cursor.fetchall()
  
      # Expect results to have a length of the number of checks made and that
      # each result equals one.
      if not state_check_results or 1 != len(state_check_results) or 1 != state_check_results[0][0]:
          raise StateMatchingError("The provided state differs from the database state", state)
function_tokens: def check_state ( state , state_checks , cursor ) -> None : # Skip actual tests if state checking is disabled in state if is_disabled ( state ) : return sql_checks = [ sc . sql for sc in state_checks ] args : List = [ ] for sc in state_checks : args . extend ( p for p in sc . params ) if sql_checks : cursor . execute ( "(" + ") INTERSECT (" . join ( sql_checks ) + ")" , args ) else : cursor . execute ( "SELECT 1" ) state_check_results = cursor . fetchall ( ) # Expect results to have a length of the number of checks made and that # each result equals one. if not state_check_results or 1 != len ( state_check_results ) or 1 != state_check_results [ 0 ] [ 0 ] : raise StateMatchingError ( "The provided state differs from the database state" , state )