Skip to content

Commit

Permalink
delete unneeded _get_value() function and unneeded test parms
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Dec 22, 2024
1 parent ad05e37 commit 552dd32
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
4 changes: 0 additions & 4 deletions src/diffpy/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ def get_user_info(owner_name=None, owner_email=None, owner_orcid=None):
return user_info


def _get_value(mystring):
return mystring.strip()


def check_and_build_global_config(skip_config_creation=False):
config_path = Path().home() / "diffpyconfig.json"
if skip_config_creation:
Expand Down
65 changes: 0 additions & 65 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,71 +7,6 @@

from diffpy.utils.tools import check_and_build_global_config, get_package_info, get_user_info

# def _setup_dirs(monkeypatch, user_filesystem):
# home_dir, cwd_dir = user_filesystem.home_dir, user_filesystem.cwd_dir
# os.chdir(cwd_dir)
# return home_dir
#


def _run_tests(inputs, expected):
args = {"username": inputs[0], "email": inputs[1]}
expected_username, expected_email = expected
config = get_user_info(args)
assert config.get("username") == expected_username
assert config.get("email") == expected_email


params_user_info_with_local_conf_file = [
(["", ""], ["cwd_username", "cwd@email.com"]),
(["cli_username", ""], ["cli_username", "cwd@email.com"]),
(["", "cli@email.com"], ["cwd_username", "cli@email.com"]),
([None, None], ["cwd_username", "cwd@email.com"]),
(["cli_username", None], ["cli_username", "cwd@email.com"]),
([None, "cli@email.com"], ["cwd_username", "cli@email.com"]),
(["cli_username", "cli@email.com"], ["cli_username", "cli@email.com"]),
]
params_user_info_with_no_home_conf_file = [
(
[None, None],
["input_username", "input@email.com"],
["input_username", "input@email.com"],
),
(
["cli_username", None],
["", "input@email.com"],
["cli_username", "input@email.com"],
),
(
[None, "cli@email.com"],
["input_username", ""],
["input_username", "cli@email.com"],
),
(
["", ""],
["input_username", "input@email.com"],
["input_username", "input@email.com"],
),
(
["cli_username", ""],
["", "input@email.com"],
["cli_username", "input@email.com"],
),
(
["", "cli@email.com"],
["input_username", ""],
["input_username", "cli@email.com"],
),
(
["cli_username", "cli@email.com"],
["input_username", "input@email.com"],
["cli_username", "cli@email.com"],
),
]
params_user_info_no_conf_file_no_inputs = [
([None, None], ["", ""], ["", ""]),
]


@pytest.mark.parametrize(
"runtime_inputs, expected",
Expand Down

0 comments on commit 552dd32

Please sign in to comment.