code: def test_discover_same_context():
      target1 = random_example()
      context = [
          {"positive": random_example(), "negative": random_example()},
          {"positive": random_example(), "negative": random_example()},
      ]
  
      response = request_with_validation(
          api="/collections/{collection_name}/points/discover",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "target": target1,
              "context": context,
              "limit": 8,
              "params": {
                  "exact": True,
              },
          },
      )
      assert response.ok, response.json()
  
      scored_points1 = response.json()["result"]
  
      assert len(scored_points1) == 8 - count_ids_in_examples(
          context, target1
      )
  
      target2 = random_example()
  
      response = request_with_validation(
          api="/collections/{collection_name}/points/discover",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "target": target2,
              "context": context,
              "limit": 8,
              "params": {
                  "exact": True,
              },
          },
      )
      assert response.ok, response.json()
  
      scored_points2 = response.json()["result"]
  
      assert len(scored_points2) == 8 - count_ids_in_examples(
          context, target2
      )
  
      # We keep same context, so context part of the score (integer part) should be the same,
      # while target part of the score (decimal part) should be different
  
      scored_points_2_map = {
          point["id"]: point for point in scored_points2
      }
  
      for point1, point2 in zip(scored_points1, scored_points2):
          if point1["id"] in scored_points_2_map:
              point2 = scored_points_2_map[point1["id"]]
              assert math.floor(point1["score"]) == math.floor(
                  point2["score"]
              )
  
              target_score1 = point1["score"] - math.floor(
                  point1["score"]
              )
              target_score2 = point2["score"] - math.floor(
                  point2["score"]
              )
              if target1 == target2:
                  assert math.isclose(
                      target_score1, target_score2, rel_tol=1e-5
                  )
              else:
                  assert not math.isclose(
                      target_score1, target_score2, rel_tol=1e-5
                  )
  
file_path: qdrant/openapi/tests/openapi_integration/test_discovery.py
imports: import math
  import random
  import pytest
  from .helpers.collection_setup import basic_collection_setup, drop_collection
  from .helpers.helpers import request_with_validation
label_desc: Use image node_id 7 for calling a global function with example usage: test_discover_same_context() without return types