MCPcopy Create free account
hub / github.com/ccxt/ccxt / test_to_array

Function test_to_array

python/ccxt/test/base/test_to_array.py:18–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16from ccxt.test.exchange.base import test_shared_methods # noqa E402
17
18def test_to_array():
19 exchange = ccxt.Exchange({
20 'id': 'sampleexchange',
21 })
22 obj1 = {
23 'a': 1,
24 'b': 3,
25 'c': 2,
26 }
27 obj2 = {
28 'a': 'x',
29 'b': 2,
30 }
31 result1 = exchange.to_array(obj1)
32 result2 = exchange.to_array(obj2)
33 # we can't guarantee order of values in GO lang
34 # testSharedMethods.assertDeepEqual (exchange, undefined, 'testToArray', exchange.toArray (obj1), [ 1, 3, 2 ]);
35 # testSharedMethods.assertDeepEqual (exchange, undefined, 'testToArray', exchange.toArray (obj2), [ 'x', 2 ]);
36 #
37 assert len(result1) == 3, 'testToArray: length of result1 should be 3'
38 assert len(result2) == 2, 'testToArray: length of result2 should be 2'
39 assert exchange.in_array(1, result1) and exchange.in_array(3, result1) and exchange.in_array(2, result1), 'testToArray: result1 should include 1, 3, and 2'
40 assert exchange.in_array('x', result2) and exchange.in_array(2, result2), 'testToArray: result2 should include "x" and 2'

Callers 1

base_tests_initFunction · 0.90

Calls 3

to_arrayMethod · 0.95
in_arrayMethod · 0.95
ExchangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…