From b6c8126589a94c2986c591ad7741cd3787a96e58 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 12 Dec 2018 17:47:25 -0800 Subject: Move zero_ex.json_schemas to its own package --- .../order_utils/test/test_json_schemas.py | 23 ---------------------- 1 file changed, 23 deletions(-) delete mode 100644 python-packages/order_utils/test/test_json_schemas.py (limited to 'python-packages/order_utils/test') diff --git a/python-packages/order_utils/test/test_json_schemas.py b/python-packages/order_utils/test/test_json_schemas.py deleted file mode 100644 index 51cecbd4f..000000000 --- a/python-packages/order_utils/test/test_json_schemas.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Tests of zero_ex.json_schemas""" - - -from zero_ex.order_utils import make_empty_order -from zero_ex.json_schemas import _LOCAL_RESOLVER, assert_valid - - -def test_assert_valid_caches_resources(): - """Test that the JSON ref resolver in `assert_valid()` caches resources - - In order to test the cache we much access the private class of - `json_schemas` and reset the LRU cache on `_LocalRefResolver`. - For this to happen, we need to disable errror `W0212` - on _LOCAL_RESOLVER - """ - _LOCAL_RESOLVER._remote_cache.cache_clear() # pylint: disable=W0212 - - assert_valid(make_empty_order(), "/orderSchema") - cache_info = ( - _LOCAL_RESOLVER._remote_cache.cache_info() # pylint: disable=W0212 - ) - assert cache_info.currsize == 4 - assert cache_info.hits == 10 -- cgit v1.2.3 From aa5af04447dfae24731557c6beead55bd8ff99a9 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 9 Jan 2019 09:58:29 -0500 Subject: Python contract demo, with lots of refactoring (#1485) * Refine Order for Web3 compat. & add conversions Changed some of the fields in the Order class so that it can be passed to our contracts via Web3. Added conversion utilities so that an Order can be easily converted to and from a JSON-compatible dict (specifically by encoding/decoding the `bytes` fields), to facilitate validation against the JSON schema. Also modified JSON order schema to accept integers in addition to stringified integers. * Fixes for json_schemas Has-types indicator file, py.typed, was not being included in package. Schemas were not being properly gathered into package installation. * Add test/demo of Exchange.getOrderInfo() * web3 bug workaround * Fix problem packaging contract artifacts * Move contract addresses to their own package * Move contract artifacts to their own package * Add scripts to install, test & lint all components * prettierignore files in local python dev env * Correct missing coverage analysis for sra_client * CI cache lint: don't save, re-use from test-python * tag hacks as hacks * correct merge mistake * remove local strip_0x() in favor of eth_utils * remove json schemas from old order_utils location * correct merge mistake * doctest json schemas via command-line, not code --- python-packages/order_utils/test/test_doctest.py | 18 ------------------ .../order_utils/test/test_generate_order_hash_hex.py | 4 +++- 2 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 python-packages/order_utils/test/test_doctest.py (limited to 'python-packages/order_utils/test') diff --git a/python-packages/order_utils/test/test_doctest.py b/python-packages/order_utils/test/test_doctest.py deleted file mode 100644 index 297f75e75..000000000 --- a/python-packages/order_utils/test/test_doctest.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Exercise doctests for all of our modules.""" - -from doctest import testmod -import pkgutil -import importlib - -import zero_ex - - -def test_all_doctests(): - """Gather zero_ex.* modules and doctest them.""" - for (_, modname, _) in pkgutil.walk_packages( - path=zero_ex.__path__, prefix="zero_ex." - ): - module = importlib.import_module(modname) - print(module) - (failure_count, _) = testmod(module) - assert failure_count == 0 diff --git a/python-packages/order_utils/test/test_generate_order_hash_hex.py b/python-packages/order_utils/test/test_generate_order_hash_hex.py index 6869a40ed..38b503289 100644 --- a/python-packages/order_utils/test/test_generate_order_hash_hex.py +++ b/python-packages/order_utils/test/test_generate_order_hash_hex.py @@ -8,5 +8,7 @@ def test_get_order_hash_hex__empty_order(): expected_hash_hex = ( "faa49b35faeb9197e9c3ba7a52075e6dad19739549f153b77dfcf59408a4b422" ) - actual_hash_hex = generate_order_hash_hex(make_empty_order()) + actual_hash_hex = generate_order_hash_hex( + make_empty_order(), "0x0000000000000000000000000000000000000000" + ) assert actual_hash_hex == expected_hash_hex -- cgit v1.2.3