input: Write a function to parse a JSON data structure and extract the 'name', 'age', and 'occupation' fields from it. The function should return a tuple containing these three fields. If the JSON data is invalid or missing any of these fields, the function should raise a ValueError.
  assert parse_json('{"name": "John", "age": 18, "occupation": "Software Engineer"}') == ("John", 18, "Software Engineer")
  assert parse_json('{"name": "Alice", "age": 25, "occupation": "Teacher"}') == ("Alice", 25, "Teacher")
  try:
      parse_json('{"name": "Bob", "occupation": "Doctor"}')
  except ValueError:
      assert True
  else:
      assert False
  try:
      parse_json('{"age": 30, "occupation": "Artist"}')
  except ValueError:
      assert True
  else:
      assert False
  try:
      parse_json('invalid JSON')
  except ValueError:
      assert True
  else:
      assert False
output: import json
  
  def parse_json(json_str):
      try:
          data = json.loads(json_str)
          name = data['name']
          age = data['age']
          occupation = data['occupation']
          return (name, age, occupation)
      except (json.JSONDecodeError, KeyError):
          raise ValueError