code: def test_too_long_query(api):
      # Test whether our limit calculation is reasonably correct and
      # that a relevant error message is provided
  
      def create_query(n):
          return '"' + " a_-.*:,?+~!" * n + '"'
  
      # Expect no error
      q = create_query(162)
      assert 0.99 < SentinelAPI.check_query_length(q) < 1.0
      count = api.count(raw=q)
      assert count == 0
  
      # Expect HTTP status 500 Internal Server Error
      q = create_query(163)
      assert 0.999 <= SentinelAPI.check_query_length(q) < 1.01
      with pytest.raises(QueryLengthError) as excinfo:
          api.count(raw=q)
      assert "x times the maximum allowed" in str(excinfo.value)
  
imports: from contextlib import contextmanager
  from datetime import datetime, date, timedelta
  import pytest
  import requests_mock
  from requests.exceptions import StreamConsumedError, ContentDecodingError, InvalidProxyURL, InvalidHeader, TooManyRedirects, ReadTimeout, SSLError
  from sentinelsat import format_query_date, SentinelAPI
  from sentinelsat.exceptions import QuerySyntaxError, QueryLengthError, UnauthorizedError
  from sentinelsat.sentinel import _format_order_by
label_desc: Use image node_id 18 for calling a global function with example usage: test_too_long_query(api) and returns: unknown