Skip to content

Commit

Permalink
introduce MockRow class for object comparison checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmshi committed Nov 26, 2024
1 parent c52dfe0 commit dea2d04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions providers/tests/snowflake/operators/test_snowflake_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# under the License.
from __future__ import annotations

from typing import Any
from unittest import mock
from unittest.mock import MagicMock, patch

Expand All @@ -26,8 +25,15 @@
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator


def MockRow(*args: Any, **kwargs: Any) -> MagicMock:
return MagicMock()
class MockRow:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)

def __eq__(self, other):
return isinstance(other, MockRow) and self.__dict__ == other.__dict__

def __repr__(self):
return f"MockRow({self.__dict__})"


from airflow.models.connection import Connection
Expand Down

0 comments on commit dea2d04

Please sign in to comment.