Skip to content

Commit

Permalink
Making changes to fix issues flagged by static checker mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nachiappan Veerappan Nachiappan authored and Nachiappan Veerappan Nachiappan committed Jun 6, 2024
1 parent 3da2463 commit cf9c7d6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/web/test_db_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, Mapping, MutableMapping, Optional
from typing import Any, Dict, Mapping, MutableMapping, Optional
from unittest import mock

import pytest
Expand Down Expand Up @@ -766,8 +766,20 @@ def test_db_query_with_disable_lua_scripts() -> None:
key = get_query_cache_key(formatted_query)
cached_value = _get_cache_partition(reader).get(key)
assert cached_value is not None, "cached_value is None"
assert mock_result["data"][0] == cached_value.get("data")[0]
assert mock_result["meta"][0] == cached_value.get("meta")[0]
if mock_result["data"] and cached_value.get("data"):
mock_data = mock_result.get("data")
cached_data = cached_value.get("data")
if isinstance(mock_data, list) and isinstance(cached_data, list):
if mock_data and cached_data:
if mock_data[0] is not None and cached_data[0] is not None:
assert mock_data[0] == cached_data[0]
if mock_result["meta"] and cached_value.get("meta"):
mock_meta = mock_result.get("meta")
cached_meta = cached_value.get("meta")
if isinstance(mock_meta, list) and isinstance(cached_meta, list):
if mock_meta and cached_meta:
if mock_meta[0] is not None and cached_meta[0] is not None:
assert mock_meta[0] == cached_meta[0]


@pytest.mark.redis_db
Expand All @@ -793,7 +805,7 @@ def test_clickhouse_settings_applied_to_query_id(
query_settings = HTTPQuerySettings()
formatted_query = format_query(query)
reader = mock.MagicMock()
clickhouse_query_settings = {}
clickhouse_query_settings: Dict[str, Any] = {}
robust = False
referrer = "test"

Expand Down

0 comments on commit cf9c7d6

Please sign in to comment.