input: Write a function to parse a JSON data structure and extract the values associated with the keys 'name', 'age', and 'occupation'. The function should return these values as a tuple. If the input is not a valid JSON string, 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": "Data Scientist"}')==("Alice", 25, "Data Scientist")
  assert parse_json('{"name": "Bob", "age": 30, "occupation": "Teacher"}')==("Bob", 30, "Teacher")
output: def parse_json(json_str):
      import json
      try:
          data = json.loads(json_str)
          return (data['name'], data['age'], data['occupation'])
      except (json.JSONDecodeError, KeyError):
          raise ValueError