()
| 16 | from ccxt.test.exchange.base import test_shared_methods # noqa E402 |
| 17 | |
| 18 | def 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' |
no test coverage detected
searching dependent graphs…