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

Function test_is_empty

python/ccxt/test/base/test_is_empty.py:18–38  ·  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_is_empty():
19 exchange = ccxt.Exchange({
20 'id': 'sampleexchange',
21 })
22 assert exchange.is_empty(None), 'undefined should be empty'
23 assert exchange.is_empty(None), 'null should be empty'
24 assert exchange.is_empty({}), 'empty object should be empty'
25 assert exchange.is_empty([]), 'empty array should be empty'
26 assert exchange.is_empty({
27 'foo': 1,
28}) is False, 'non-empty object should not be empty'
29 assert exchange.is_empty([1, 2]) is False, 'non-empty array should not be empty'
30 # below are scalars, so they are not checked.
31 # @ts-expect-error
32 assert exchange.is_empty('') is False, 'empty string should return false'
33 # @ts-expect-error
34 assert exchange.is_empty(0) is False, 'zero should return false'
35 # @ts-expect-error
36 assert exchange.is_empty(False) is False, 'false should return false'
37 # @ts-expect-error
38 assert exchange.is_empty('non-empty string') is False, 'non-empty string should not be empty'

Callers 1

base_tests_initFunction · 0.90

Calls 2

is_emptyMethod · 0.95
ExchangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…