Skip to content

Commit

Permalink
mark deprecated sha3 method as static with a test
Browse files Browse the repository at this point in the history
  • Loading branch information
nbt-rezaem authored and kclowes committed May 9, 2019
1 parent a5d8c66 commit 388cd2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/core/web3-module/test_keccak.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,10 @@ def test_keccak_raise_if_hexstr_and_text():
def test_keccak_raise_if_no_args():
with pytest.raises(TypeError):
Web3.keccak()


def test_deprecated_bound_method():
w3 = Web3()
h = HexBytes('0x0f355f04c0a06eebac1d219b34c598f85a1169badee164be8a30345944885fe8')
with pytest.warns(DeprecationWarning, match='sha3 is deprecated in favor of keccak'):
assert w3.sha3(text='cowmö') == h
1 change: 1 addition & 0 deletions web3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def api(self):
from web3 import __version__
return __version__

@staticmethod
@deprecated_for("keccak")
@apply_to_return_value(HexBytes)
def sha3(primitive=None, text=None, hexstr=None):
Expand Down

0 comments on commit 388cd2d

Please sign in to comment.