diff --git a/tests/matrixstore/test_service.py b/tests/matrixstore/test_service.py index 4de3b1894a..65ce952e1d 100644 --- a/tests/matrixstore/test_service.py +++ b/tests/matrixstore/test_service.py @@ -19,7 +19,6 @@ from unittest.mock import ANY, Mock import numpy as np -import pandas as pd import pytest from fastapi import UploadFile from starlette.datastructures import Headers @@ -53,11 +52,11 @@ def test_create__nominal_case(self, matrix_service: MatrixService) -> None: # A "real" hash value is calculated assert matrix_id, "ID can't be empty" - # The matrix is saved in the content repository as a HDF file + # The matrix is saved in the content repository as a TSV file bucket_dir = matrix_service.matrix_content_repository.bucket_dir - content_path = bucket_dir.joinpath(f"{matrix_id}.hdf") - array = pd.read_hdf(content_path).__array__() - assert (array == np.array(data)).all() + content_path = bucket_dir.joinpath(f"{matrix_id}.tsv") + array = np.loadtxt(content_path) + assert array.all() == np.array(data).all() # A matrix object is stored in the database with db(): @@ -77,11 +76,11 @@ def test_create__from_numpy_array(self, matrix_service: MatrixService) -> None: # A "real" hash value is calculated assert matrix_id, "ID can't be empty" - # The matrix is saved in the content repository as an HDF file + # The matrix is saved in the content repository as a TSV file bucket_dir = matrix_service.matrix_content_repository.bucket_dir - content_path = bucket_dir.joinpath(f"{matrix_id}.hdf") - array = pd.read_hdf(content_path).__array__() - assert (array == data).all() + content_path = bucket_dir.joinpath(f"{matrix_id}.tsv") + array = np.loadtxt(content_path) + assert array.all() == data.all() # A matrix object is stored in the database with db(): @@ -103,8 +102,8 @@ def test_create__side_effect(self, matrix_service: MatrixService) -> None: # the associated matrix file must not be deleted bucket_dir = matrix_service.matrix_content_repository.bucket_dir - hdf_files = list(bucket_dir.glob("*.hdf")) - assert hdf_files + tsv_files = list(bucket_dir.glob("*.tsv")) + assert tsv_files # Nothing is stored in the database with db(): @@ -160,8 +159,8 @@ def test_delete__nominal_case(self, matrix_service: MatrixService) -> None: # The matrix in no more available in the content repository bucket_dir = matrix_service.matrix_content_repository.bucket_dir - hdf_files = list(bucket_dir.glob("*.hdf")) - assert not hdf_files + tsv_files = list(bucket_dir.glob("*.tsv")) + assert not tsv_files # The matrix object is deleted from the database with db(): @@ -176,8 +175,8 @@ def test_delete__missing(self, matrix_service: MatrixService) -> None: # then, the matrix in no more available in the content repository bucket_dir = matrix_service.matrix_content_repository.bucket_dir - hdf_files = list(bucket_dir.glob("*.hdf")) - assert not hdf_files + tsv_files = list(bucket_dir.glob("*.tsv")) + assert not tsv_files # The matrix object is deleted from the database with db(): @@ -232,14 +231,11 @@ def test_create_by_importation__nominal_case( # A "real" hash value is calculated assert info.id, "ID can't be empty" - # The matrix is saved in the content repository as an HDF file + # The matrix is saved in the content repository as a TSV file bucket_dir = matrix_service.matrix_content_repository.bucket_dir - content_path = bucket_dir.joinpath(f"{info.id}.hdf") - if content_path.stat().st_size == 0: - actual = np.empty(shape=1) - else: - actual = pd.read_hdf(content_path).__array__() - assert (actual == matrix).all() + content_path = bucket_dir.joinpath(f"{info.id}.tsv") + actual = np.loadtxt(content_path) + assert actual.all() == matrix.all() # A matrix object is stored in the database with db(): @@ -302,14 +298,11 @@ def test_create_by_importation__zip_file(self, matrix_service: MatrixService, co # A "real" hash value is calculated assert info.id, "ID can't be empty" - # The matrix is saved in the content repository as an HDF file + # The matrix is saved in the content repository as a TSV file bucket_dir = matrix_service.matrix_content_repository.bucket_dir - content_path = bucket_dir.joinpath(f"{info.id}.hdf") - if content_path.stat().st_size == 0: - actual = np.empty(shape=1) - else: - actual = pd.read_hdf(content_path).__array__() - assert (actual == matrix).all() + content_path = bucket_dir.joinpath(f"{info.id}.tsv") + actual = np.loadtxt(content_path) + assert actual.all() == matrix.all() # A matrix object is stored in the database with db():