From 2991399c7010e94fd8a9eec40ddf7ee2f1c94a64 Mon Sep 17 00:00:00 2001 From: Nathan Frey Date: Tue, 14 May 2024 10:19:14 -0400 Subject: [PATCH] lobster beignet dependencies --- src/beignet/features/__init__.py | 4 +- tests/__init__.py | 0 tests/beignet/__init__.py | 0 tests/beignet/features/conftest.py | 8 ++ tests/beignet/features/test__feature.py | 2 - tests/beignet/io/test__load_omega_config.py | 106 -------------------- tests/beignet/io/test__load_parquet.py | 2 +- tests/beignet/io/test__parse_s3_path.py | 2 +- 8 files changed, 12 insertions(+), 112 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/beignet/__init__.py create mode 100644 tests/beignet/features/conftest.py delete mode 100644 tests/beignet/io/test__load_omega_config.py diff --git a/src/beignet/features/__init__.py b/src/beignet/features/__init__.py index fa3a93d8f8..3cf6ca1340 100644 --- a/src/beignet/features/__init__.py +++ b/src/beignet/features/__init__.py @@ -1,5 +1,5 @@ -from ._feature import Feature +from ._features import Feature __all__ = [ "Feature", -] \ No newline at end of file +] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/beignet/__init__.py b/tests/beignet/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/beignet/features/conftest.py b/tests/beignet/features/conftest.py new file mode 100644 index 0000000000..d23942423e --- /dev/null +++ b/tests/beignet/features/conftest.py @@ -0,0 +1,8 @@ +import pytest +import torch +from yeji.features._feature import Feature + + +@pytest.fixture +def feature() -> Feature: + return Feature(torch.tensor([1, 2, 3])) diff --git a/tests/beignet/features/test__feature.py b/tests/beignet/features/test__feature.py index 8867c20253..02d30af4ac 100644 --- a/tests/beignet/features/test__feature.py +++ b/tests/beignet/features/test__feature.py @@ -24,8 +24,6 @@ def test___torch_function__(self, feature: Feature): (feature, torch.tensor([1, 2, 3])), ) - assert torch.is_tensor(result) - assert not isinstance(result, Feature) def test_device(self, feature: Feature): diff --git a/tests/beignet/io/test__load_omega_config.py b/tests/beignet/io/test__load_omega_config.py deleted file mode 100644 index 1911f457a9..0000000000 --- a/tests/beignet/io/test__load_omega_config.py +++ /dev/null @@ -1,106 +0,0 @@ -import os -from unittest import mock - -import pytest -from omegaconf import DictConfig -from prescient.io import load_omega_config - -TEST_CONFIG_DIR = os.path.join(os.path.dirname(__file__), "configs") - - -@mock.patch("prescient.io._load_omega_config.S3FileSystem") -@mock.patch("prescient.io._load_omega_config.yaml.load", return_value={}) -@mock.patch("builtins.open", new_callable=mock.mock_open, read_data="") -@pytest.mark.parametrize( - "config_dir, config_name, compose, overrides", - [ - pytest.param("s3://bucket/foo", "config.yaml", False, None, id="S3 path"), - pytest.param( - os.path.abspath(TEST_CONFIG_DIR), - "test.yaml", - True, - ["+foo=bar"], - id="Absolute path with config_name, compose=True", - ), - pytest.param( - os.path.abspath(TEST_CONFIG_DIR), - "test.yaml", - False, - None, - id="Absolute path, compose=False", - ), - pytest.param( - TEST_CONFIG_DIR, - "test.yaml", - True, - ["+foo=bar"], - id="Relative path, compose=True", - ), - pytest.param( - TEST_CONFIG_DIR, - "test.yaml", - False, - None, - id="Relative path, compose=False", - ), - pytest.param( - TEST_CONFIG_DIR, - "test", - False, - None, - id="Relative path with config_name without yaml suffix, compose=False", - ), - ], -) -def test_load_omega_config( - mock_yaml_load, - mock_s3_file_system, - mock_builtin_open, - config_dir, - config_name, - compose, - overrides, -): - mock_s3_file_system.open = mock.mock_open(read_data="") - - result = load_omega_config( - config_dir=config_dir, - config_name=config_name, - compose=compose, - overrides=overrides, - ) - assert isinstance(result, DictConfig) - - -@pytest.mark.parametrize( - "config_dir, config_name, compose, overrides", - [ - pytest.param( - TEST_CONFIG_DIR, - None, - False, - ["+foo=bar"], - id="compose=False with overrides", - ), - pytest.param( - f"{TEST_CONFIG_DIR}/test.yaml", - None, - False, - None, - id="config dir is a file", - ), - ], -) -def test_load_omega_config_errors( - config_dir, - config_name, - compose, - overrides, -): - with pytest.raises(ValueError): - load_omega_config( - config_dir=config_dir, - config_name=config_name, - compose=compose, - overrides=overrides, - ) diff --git a/tests/beignet/io/test__load_parquet.py b/tests/beignet/io/test__load_parquet.py index 3e19272505..1b80d9dbea 100644 --- a/tests/beignet/io/test__load_parquet.py +++ b/tests/beignet/io/test__load_parquet.py @@ -1,6 +1,6 @@ import pandas as pd import pytest -from prescient.io._load_parquet import load_parquet_to_pandas +from beignet.io._load_parquet import load_parquet_to_pandas @pytest.fixture diff --git a/tests/beignet/io/test__parse_s3_path.py b/tests/beignet/io/test__parse_s3_path.py index 1decfcca31..59a76f5596 100644 --- a/tests/beignet/io/test__parse_s3_path.py +++ b/tests/beignet/io/test__parse_s3_path.py @@ -1,4 +1,4 @@ -from prescient.io._parse_s3_path import parse_s3_path +from beignet.io._parse_s3_path import parse_s3_path def test_parse_s3_path():