Skip to content

Commit

Permalink
added tests for pandas converter and yandex disk
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Denisov committed Nov 21, 2023
1 parent 7f42866 commit 48c9d72
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/query_runner/test_yandex_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,33 @@ def test_run_query(mocked_requests, mock_yandex_disk):
assert data == expected_data


@skip_condition
def test_run_query_with_empty_query(mock_yandex_disk):
result = mock_yandex_disk.run_query("", "user")
assert result == (None, "Query is empty")


@skip_condition
def test_run_query_bad_yaml(mock_yandex_disk):
bad_yaml_query = "unparseable = yaml"
result = mock_yandex_disk.run_query(bad_yaml_query, "user")
assert result == (None, "The query format must be JSON or YAML")


@skip_condition
def test_run_query_without_path(mock_yandex_disk):
bad_yaml_query = "without: path"
result = mock_yandex_disk.run_query(bad_yaml_query, "user")
assert result == (None, "The query must contain path")


@skip_condition
def test_run_query_unsupported_extension(mock_yandex_disk):
bad_yaml_query = "path: /tmp/file.txt"
result = mock_yandex_disk.run_query(bad_yaml_query, "user")
assert result == (None, "Unsupported file extension: txt")


@skip_condition
def test_read_xlsx():
output = BytesIO()
Expand Down
3 changes: 3 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def test_render(self):


@pytest.fixture
@skip_condition
def mock_dataframe():
df = pd.DataFrame(
{
Expand All @@ -136,6 +137,7 @@ def mock_dataframe():
return df


@skip_condition
def test_get_column_types_from_dataframe(mock_dataframe):
result = get_column_types_from_dataframe(mock_dataframe)
expected_output = [
Expand All @@ -150,6 +152,7 @@ def test_get_column_types_from_dataframe(mock_dataframe):
assert result == expected_output


@skip_condition
def test_pandas_to_result(mock_dataframe):
result = pandas_to_result(mock_dataframe)

Expand Down

0 comments on commit 48c9d72

Please sign in to comment.