From db7099f6b9ede2804ccb449d09f8220ada31426c Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Thu, 27 Jun 2024 08:23:09 -0700 Subject: [PATCH] Compatibility with NumPy 2.0 (#14) Update changelog as well --- CHANGELOG.md | 11 +++++++---- tests/conftest.py | 4 ++++ tests/test_polish_dataset.py | 10 +++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 205cc5e..c6b4075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog -## Version 0.1 (development) +## Version 0.2.0 -- Feature A added -- FIX: nasty bug #1729 fixed -- add your changes here! +- Changes to support NumPy's 2.0 release. + +## Version 0.1.0 - 0.1.3 + +First release of the package to access, download and save +datasets. diff --git a/tests/conftest.py b/tests/conftest.py index d716147..2ab8a0c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,3 +7,7 @@ """ # import pytest + +# only if certificates are not available for local testing +# from gypsum_client.config import REQUESTS_MOD +# REQUESTS_MOD["verify"] = False diff --git a/tests/test_polish_dataset.py b/tests/test_polish_dataset.py index 415518f..eabab06 100644 --- a/tests/test_polish_dataset.py +++ b/tests/test_polish_dataset.py @@ -120,31 +120,31 @@ def test_polish_dataset_attempts_integer_conversions(): sce = SingleCellExperiment(assays={"counts": mat}) y = polish_dataset(sce) - assert y.assays["counts"].dtype == np.int_ + assert np.issubdtype(y.assays["counts"].dtype, np.integer) mat = np.random.poisson(0.1, (100, 10)).astype(float) sce = SingleCellExperiment(assays={"counts": sparse.csr_matrix(mat)}) y = polish_dataset(sce) assert sparse.issparse(y.assays["counts"]) - assert y.assays["counts"].dtype == np.int_ + assert np.issubdtype(y.assays["counts"].dtype, np.integer) mat = np.random.poisson(3, (100, 10)) * 1.5 sce = SingleCellExperiment(assays={"counts": mat}) y = polish_dataset(sce) - assert y.assays["counts"].dtype == np.float_ + assert np.issubdtype(y.assays["counts"].dtype, np.floating) def test_polish_dataset_works_with_na_values(): mat = np.random.poisson(0.1, (100, 10)) - mat = mat.astype(np.float_) + mat = mat.astype(np.float64) mat.ravel()[np.random.choice(mat.size, 10, replace=False)] = np.nan sce = SingleCellExperiment(assays={"counts": sparse.csr_matrix(mat)}) y = polish_dataset(sce) assert sparse.issparse(y.assays["counts"]) - assert y.assays["counts"].dtype == np.float_ + assert np.issubdtype(y.assays["counts"].dtype, np.floating) def test_polish_dataset_forbids_highly_nested_altexps():