Skip to content

Commit

Permalink
update 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorfturner authored and taylorfturner committed Jun 14, 2024
1 parent 03a7e4d commit 997207f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10"]
python-version: [3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
43 changes: 19 additions & 24 deletions dataprofiler/tests/labelers/test_labeler_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import tempfile
import unittest
from unittest import mock

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -235,9 +235,7 @@ def test_verbose(self):
self.assertIn("f1-score ", log_output)
self.assertIn("F1 Score: ", log_output)

@mock.patch("dataprofiler.labelers.labeler_utils.classification_report")
@mock.patch("pandas.DataFrame")
def test_save_conf_mat(self, mock_dataframe, mock_report):
def test_save_conf_mat(self):

# ideally mock out the actual contents written to file, but
# would be difficult to get this completely worked out.
Expand All @@ -248,28 +246,25 @@ def test_save_conf_mat(self, mock_dataframe, mock_report):
[0, 1, 2],
]
)
expected_row_col_names = dict(
columns=["pred:PAD", "pred:UNKNOWN", "pred:OTHER"],
index=["true:PAD", "true:UNKNOWN", "true:OTHER"],
)
mock_instance_df = mock.Mock(spec=pd.DataFrame)()
mock_dataframe.return_value = mock_instance_df

# still omit bc confusion mat should include all despite omit
f1, f1_report = labeler_utils.evaluate_accuracy(
self.y_pred,
self.y_true,
self.num_labels,
self.reverse_label_mapping,
omitted_labels=["PAD"],
verbose=False,
confusion_matrix_file="test.csv",
)
expected_columns = ["pred:PAD", "pred:UNKNOWN", "pred:OTHER"]
expected_index = ["true:PAD", "true:UNKNOWN", "true:OTHER"]

self.assertTrue((mock_dataframe.call_args[0][0] == expected_conf_mat).all())
self.assertDictEqual(expected_row_col_names, mock_dataframe.call_args[1])
with tempfile.NamedTemporaryFile() as tmpFile:
# still omit bc confusion mat should include all despite omit
f1, f1_report = labeler_utils.evaluate_accuracy(
self.y_pred,
self.y_true,
self.num_labels,
self.reverse_label_mapping,
omitted_labels=["PAD"],
verbose=False,
confusion_matrix_file=tmpFile.name,
)

mock_instance_df.to_csv.assert_called()
df1 = pd.read_csv(tmpFile.name, index_col=0)
self.assertListEqual(list(df1.columns), expected_columns)
self.assertListEqual(list(df1.index), expected_index)
np.testing.assert_array_equal(df1.values, expected_conf_mat)


class TestTFFunctions(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coverage>=5.0.1
dask>=2.29.0,<2024.2.0
dask[dask-expr,dataframe]>=2024.4.1
fsspec>=0.3.3
pytest>=6.0.1
pytest-cov>=2.8.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
setup(
name="DataProfiler",
version=__version__,
python_requires=">=3.8",
python_requires=">=3.9",
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py39, py310, pypi-description, manifest, precom
envlist = py39, py310, 311, pypi-description, manifest, precom


[testenv]
Expand Down

0 comments on commit 997207f

Please sign in to comment.