diff options
author | F. Eugene Aumson <feuGeneA@users.noreply.github.com> | 2018-10-24 00:08:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 00:08:16 +0800 |
commit | 1f0c7f8fbeba90ac1f65c57ff58782051c751b3d (patch) | |
tree | c5239e139729d6e4e63454c24679e8559f7c7560 /python-packages/order_utils/test/test_abi_utils.py | |
parent | 1ba207f1fef4338682b4cc7e45af8c073e63d263 (diff) | |
download | dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar.gz dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar.bz2 dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar.lz dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar.xz dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.tar.zst dexon-sol-tools-1f0c7f8fbeba90ac1f65c57ff58782051c751b3d.zip |
feat(order_utils.py): ERC20 asset data encoding and decoding
In addition to the ERC20 codec, also:
Stopped ignoring type errors on 3rd party imports, by including
interface stubs for them;
Removed the unimplemented signature-utils module, which was just a
stand-in when the python project support was first put in place.
https://github.com/0xProject/0x-monorepo/pull/1144
Diffstat (limited to 'python-packages/order_utils/test/test_abi_utils.py')
-rw-r--r-- | python-packages/order_utils/test/test_abi_utils.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/python-packages/order_utils/test/test_abi_utils.py b/python-packages/order_utils/test/test_abi_utils.py new file mode 100644 index 000000000..49a2a4f20 --- /dev/null +++ b/python-packages/order_utils/test/test_abi_utils.py @@ -0,0 +1,53 @@ +"""Tests of 0x.abi_utils.""" + +import pytest + +from zero_ex.dev_utils.abi_utils import ( + elementary_name, + event_id, + method_id, + parse_signature, + simple_encode, +) + + +def test_parse_signature_type_error(): + """Test that passing in wrong types raises TypeError.""" + with pytest.raises(TypeError): + parse_signature(123) + + +def test_parse_signature_bad_input(): + """Test that passing a non-signature string raises a ValueError.""" + with pytest.raises(ValueError): + parse_signature("a string that's not even close to a signature") + + +def test_elementary_name_type_error(): + """Test that passing in wrong types raises TypeError.""" + with pytest.raises(TypeError): + elementary_name(123) + + +def test_event_id_type_error(): + """Test that passing in wrong types raises TypeError.""" + with pytest.raises(TypeError): + event_id(123, []) + + with pytest.raises(TypeError): + event_id("valid string", 123) + + +def test_method_id_type_error(): + """Test that passing in wrong types raises TypeError.""" + with pytest.raises(TypeError): + method_id(123, []) + + with pytest.raises(TypeError): + method_id("ERC20Token", 123) + + +def test_simple_encode_type_error(): + """Test that passing in wrong types raises TypeError.""" + with pytest.raises(TypeError): + simple_encode(123) |