Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 6, 2023
1 parent 9df4356 commit 6dda086
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
13 changes: 5 additions & 8 deletions python-sdk/tests/sql/operators/test_base_decorator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest import mock

import pytest

from astro.sql import RawSQLOperator
Expand All @@ -13,15 +14,11 @@ def test_base_sql_decorated_operator_template_fields_with_parameters():
assert "parameters" in BaseSQLDecoratedOperator.template_fields


@pytest.mark.parametrize(
"exception", [OSError("os error"), TypeError("type error")]
)
@pytest.mark.parametrize("exception", [OSError("os error"), TypeError("type error")])
@mock.patch("astro.sql.operators.base_decorator.inspect.getsource", autospec=True)
def test_get_source_code_handle_exception(mock_getsource, exception):
"""assert get_source_code not raise exception"""
mock_getsource.side_effect = exception
RawSQLOperator(
task_id="test",
sql="select * from 1",
python_callable=lambda: 1
).get_source_code(py_callable=None)
RawSQLOperator(task_id="test", sql="select * from 1", python_callable=lambda: 1).get_source_code(
py_callable=None
)
14 changes: 5 additions & 9 deletions python-sdk/tests/sql/operators/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import astro.sql as aql
from astro.airflow.datasets import DATASET_SUPPORT
from astro.files import File
from astro.table import Table
from astro.sql.operators.dataframe import DataframeOperator
from astro.table import Table

from ..operators import utils as test_utils

Expand Down Expand Up @@ -238,15 +238,11 @@ def count_df(df: pandas.DataFrame):
mock_serde.deserialize.assert_not_called()


@pytest.mark.parametrize(
"exception", [OSError("os error"), TypeError("type error")]
)
@pytest.mark.parametrize("exception", [OSError("os error"), TypeError("type error")])
@mock.patch("astro.sql.operators.base_decorator.inspect.getsource", autospec=True)
def test_get_source_code_handle_exception(mock_getsource, exception):
"""assert get_source_code not raise exception"""
mock_getsource.side_effect = exception
DataframeOperator(
task_id="test",
sql="select * from 1",
python_callable=lambda: 1
).get_source_code(py_callable=None)
DataframeOperator(task_id="test", sql="select * from 1", python_callable=lambda: 1).get_source_code(
py_callable=None
)

0 comments on commit 6dda086

Please sign in to comment.