Skip to content

Commit

Permalink
fix: empty plugins list
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 29, 2023
1 parent 7a8e273 commit 15a6304
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/ape/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ def add_padding_to_strings(
List[str]: A list of equal-length strings with padded spaces.
"""

if not str_list:
return []

longest_item = len(max(str_list, key=len))
spaced_items = []

Expand Down
8 changes: 5 additions & 3 deletions tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ def test_get_project_without_contracts_path(project):


def test_get_project_with_contracts_path(project):
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder"
project = project.get_project(project_path, project_path / "sources")
assert project.contracts_folder == project_path / "sources"
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder_specified_in_config"
project = project.get_project(project_path, project_path / "my_contracts")
assert project.contracts_folder == project_path / "my_contracts"


def test_get_project_figure_out_contracts_path(project):
Expand All @@ -351,6 +351,8 @@ def test_get_project_figure_out_contracts_path(project):
to figure it out.
"""
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder"
(project_path / "ape-config.yaml").unlink(missing_ok=True) # Clean from prior.

project = project.get_project(project_path)
assert project.contracts_folder == project_path / "sources"

Expand Down
7 changes: 6 additions & 1 deletion tests/functional/utils/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ def test_extract_nested_value_non_dict_in_middle_returns_none():
assert not extract_nested_value(structure, "foo", "non_dict", "test")


def test_add_spacing_to_strings():
def test_add_padding_to_strings():
string_list = ["foo", "address", "ethereum"]
expected = ["foo ", "address ", "ethereum "]
actual = add_padding_to_strings(string_list, extra_spaces=4)
assert actual == expected


def test_add_padding_to_strings_empty_list():
actual = add_padding_to_strings([])
assert actual == []


def test_raises_not_implemented():
@raises_not_implemented
def unimplemented_api_method():
Expand Down

0 comments on commit 15a6304

Please sign in to comment.