input: Write a python function to handle GET and POST requests using Flask, and assert the response from GET request to return the current data set.
  assert get_data() == data
  assert post_data({'name': 'John', 'age': 30}) == data + [{'name': 'John', 'age': 30}]
  assert get_data() == data + [{'name': 'John', 'age': 30}]
output: from flask import Flask, request, jsonify
  
  app = Flask(__name__)
  data = []
  
  @app.route('/data', methods=['GET', 'POST'])
  def handle_data():
      global data
      if request.method == 'GET':
          return jsonify(data)
      elif request.method == 'POST':
          new_item = request.get_json()
          data.append(new_item)
          return jsonify(data)
  
  def get_data():
      with app.test_client() as client:
          response = client.get('/data')
          return response.get_json()
  
  def post_data(new_item):
      with app.test_client() as client:
          response = client.post('/data', json=new_item)
          return response.get_json()