Skip to content

Commit

Permalink
fix(utils): fix import statement in test_utils_env.py
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jun 25, 2023
1 parent 52fbbe6 commit a9ed751
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/hyfi/dotenv/test_dotenv.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
from hyfi.dotenv import DotEnvConfig
from hyfi.utils.envs import Envs
from hyfi.utils.envs import ENVs
from pprint import pprint


def test_dotenv_config():
os.environ["HYFI_PROJECT_NAME"] = "hyfi"
os.environ["HYFI_GLOBAL_ROOT"] = Envs.expand_posix_vars("$WORKSPACE_ROOT")
os.environ["HYFI_GLOBAL_ROOT"] = ENVs.expand_posix_vars("$WORKSPACE_ROOT")
config = DotEnvConfig()
pprint(config.dict())
# Test that the default values are set correctly
Expand Down
2 changes: 1 addition & 1 deletion tests/hyfi/joblib/test_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_pipe():
pipe_config = HyFI.pipe_config(config_name="__instance__")
pipe_config._method_ = "filter"
pipe_config.apply_to = ""
pipe_config.rcParams = {"items": ["text"]}
pipe_config.KWARGS = {"items": ["text"]}
pipe_config.verbose = True
print(pipe_config)
df4 = HyFI.pipe(df, pipe_config)
Expand Down
6 changes: 3 additions & 3 deletions tests/hyfi/path/test_path.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from hyfi.path import PathConfig
from hyfi.utils.envs import Envs
from hyfi.utils.envs import ENVs
from pathlib import Path
from pprint import pprint


def test_path_config():
config = PathConfig(
project_root="tmp",
global_hyfi_root=Envs.expand_posix_vars("$HOME/.hyfi"),
global_hyfi_root=ENVs.expand_posix_vars("$HOME/.hyfi"),
project_workspace_name="testspace",
)
pprint(config.dict())
# Test that the default values are set correctly
assert config.config_name == "__init__"
assert config.home == Envs.expand_posix_vars("$HOME")
assert config.home == ENVs.expand_posix_vars("$HOME")
assert Path(config.project_root).absolute() == (Path.cwd() / "tmp").absolute()
assert (
Path(config.project_workspace_root).absolute()
Expand Down
8 changes: 4 additions & 4 deletions tests/hyfi/utils/test_utils_env.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import unittest
from hyfi.utils.envs import Envs
from hyfi.utils.envs import ENVs


class TestExpandPosixVars(unittest.TestCase):
def test_expand_posix_vars(self):
# Test expanding $PWD and $USER variables
posix_expr = "The current working directory is $PWD and the user is $USER."
expanded_expr = Envs.expand_posix_vars(posix_expr)
expanded_expr = ENVs.expand_posix_vars(posix_expr)
self.assertIn("The current working directory is", expanded_expr)
self.assertIn("and the user is", expanded_expr)

# Test expanding custom variable
posix_expr = "The value of MY_VAR is $MY_VAR."
context = {"MY_VAR": "hello world"}
expanded_expr = Envs.expand_posix_vars(posix_expr, context)
expanded_expr = ENVs.expand_posix_vars(posix_expr, context)
self.assertIn("The value of MY_VAR is", expanded_expr)
self.assertIn("hello world", expanded_expr)

# Test expanding non-existent variable
posix_expr = "The value of NON_EXISTENT_VAR is $NON_EXISTENT_VAR."
expanded_expr = Envs.expand_posix_vars(posix_expr)
expanded_expr = ENVs.expand_posix_vars(posix_expr)
self.assertIn("The value of NON_EXISTENT_VAR is", expanded_expr)
self.assertIn("", expanded_expr)

Expand Down

0 comments on commit a9ed751

Please sign in to comment.