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

Function assert_currency_code

python/ccxt/test/exchange/base/test_shared_methods.py:166–175  ·  view source on GitHub ↗
(exchange, skipped_properties, method, entry, actual_code, expected_code=None, allow_null=True)

Source from the content-addressed store, hash-verified

164
165
166def assert_currency_code(exchange, skipped_properties, method, entry, actual_code, expected_code=None, allow_null=True):
167 if ('currency' in skipped_properties) or ('currencyIdAndCode' in skipped_properties):
168 return
169 log_text = log_template(exchange, method, entry)
170 assert actual_code is not None or allow_null, 'currency code is null' + log_text
171 if actual_code is not None:
172 assert isinstance(actual_code, str), 'currency code should be either undefined or a string' + log_text
173 assert (actual_code in exchange.currencies), 'currency code ("' + actual_code + '") should be present in exchange.currencies' + log_text
174 if expected_code is not None:
175 assert actual_code == expected_code, 'currency code in response ("' + string_value(actual_code) + '") should be equal to expected code ("' + string_value(expected_code) + '")' + log_text
176
177
178def assert_valid_currency_id_and_code(exchange, skipped_properties, method, entry, currency_id, currency_code, allow_null=True):

Callers 1

assert_fee_structureFunction · 0.85

Calls 2

log_templateFunction · 0.85
string_valueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…