Skip to content

Commit

Permalink
fix: handle when key name is optimize instead of optimizer in set (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Dec 18, 2023
1 parent 27b6c9e commit e14e101
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ethpm_types/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _get_settings_str(self) -> str:
@classmethod
def _stringify_settings(cls, settings: Dict) -> str:
# NOTE: Exclude outputSelection as it may contain contract type names.
fields = ("evmVersion", "optimizer")
fields = ("evmVersion", "optimizer", "optimize")
return stringify_dict_for_hash(settings, include=fields)

def __hash__(self) -> int:
Expand Down
11 changes: 9 additions & 2 deletions tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,19 @@ def test_compiler_hash():
settings={"evmVersion": "shanghai", "optimizer": {"enabled": False, "runs": 200}},
contractType=["test1"],
)
compiler_set = {compiler_1, compiler_2, compiler_3, compiler_4}
assert len(compiler_set) == 3
compiler_5 = Compiler(
name="yo",
version="0.2.0",
settings={"evmVersion": "shanghai", "optimize": True},
contractType=["test1"],
)
compiler_set = {compiler_1, compiler_2, compiler_3, compiler_4, compiler_5}
assert len(compiler_set) == 4
assert compiler_1 in compiler_set
assert compiler_2 in compiler_set
assert compiler_3 in compiler_set
assert compiler_4 in compiler_set
assert compiler_5 in compiler_set


def test_checksum_from_file():
Expand Down

0 comments on commit e14e101

Please sign in to comment.