class_docstr: TestEventFile handles caching results of test events within a test file
class_docstr_tok: ["TestEventFile","handles","caching","results","of","test","events","within","a","test","file"]
docstr: Helper to json load the contents of a file with some error handling
  
  Test files should be formatted as:
  
  [
      {
          "data": {},
          "description": "...",
          "...": "..."
      }
  ]
  
  Returns:
      dict: Loaded JSON from test event file
docstr_tok: ["Helper","to","json","load","the","contents","of","a","file","with","some","error","handling","Test","files","should","be","formatted","as",":","[","{","``","data","''",":","{","}",",","``","description","''",":","``","...","''",",","``","...","''",":","``","...","''","}","]","Returns",":","dict",":","Loaded","JSON","from","test","event","file"]
code: def load_file(self):
      """Helper to json load the contents of a file with some error handling
  
      Test files should be formatted as:
  
      [
          {
              "data": {},
              "description": "...",
              "...": "..."
          }
      ]
  
      Returns:
          dict: Loaded JSON from test event file
      """
      with open(self._full_path, "r") as test_event_file:
          try:
              data = json.load(test_event_file)
          except (ValueError, TypeError):
              self.error = "Test event file is not valid JSON"
              return
  
          if not isinstance(data, list):
              self.error = "Test event file is improperly formatted; events should be in a list"
              return
  
          for event in data:
              yield event
  
file_path: streamalert/streamalert_cli/test/event_file.py
imports: import json
  from streamalert.shared.logger import get_logger
  from streamalert_cli.test.results import TestResult
  from streamalert_cli.test.format import format_red, format_underline
label_desc: Use image node_id 9 for calling the TestEventFile obj's underlying member method code with example usage: obj.load_file() without return types