MCPcopy Index your code
hub / github.com/ccxt/ccxt / test_exchange_response_statically

Method test_exchange_response_statically

python/ccxt/test/tests_sync.py:1121–1175  ·  view source on GitHub ↗
(self, exchange_name, exchange_data, test_name=None)

Source from the content-addressed store, hash-verified

1119 return True # in c# methods that will be used with promiseAll need to return something
1120
1121 def test_exchange_response_statically(self, exchange_name, exchange_data, test_name=None):
1122 exchange = self.init_offline_exchange(exchange_name)
1123 # read apiKey/secret from the test file
1124 api_key = exchange.safe_string(exchange_data, 'apiKey')
1125 if not exchange.is_empty_string(api_key):
1126 exchange.apiKey = str(api_key)
1127 secret = exchange.safe_string(exchange_data, 'secret')
1128 if not exchange.is_empty_string(secret):
1129 exchange.secret = str(secret)
1130 private_key = exchange.safe_string(exchange_data, 'privateKey')
1131 if not exchange.is_empty_string(private_key):
1132 exchange.privateKey = str(private_key)
1133 wallet_address = exchange.safe_string(exchange_data, 'walletAddress')
1134 if not exchange.is_empty_string(wallet_address):
1135 exchange.walletAddress = str(wallet_address)
1136 methods = exchange.safe_value(exchange_data, 'methods', {})
1137 options = exchange.safe_value(exchange_data, 'options', {})
1138 # exchange.options = exchange.deepExtend (exchange.options, options); # custom options to be used in the tests
1139 exchange.extend_exchange_options(options)
1140 methods_names = list(methods.keys())
1141 for i in range(0, len(methods_names)):
1142 method = methods_names[i]
1143 results = methods[method]
1144 for j in range(0, len(results)):
1145 result = results[j]
1146 description = exchange.safe_value(result, 'description')
1147 old_exchange_options = exchange.options # snapshot options;
1148 test_exchange_options = exchange.safe_value(result, 'options', {})
1149 # exchange.options = exchange.deepExtend (oldExchangeOptions, testExchangeOptions); # custom options to be used in the tests
1150 exchange.extend_exchange_options(exchange.deep_extend(old_exchange_options, test_exchange_options))
1151 is_disabled = exchange.safe_bool(result, 'disabled', False)
1152 if is_disabled:
1153 continue
1154 is_disabled_c_sharp = exchange.safe_bool(result, 'disabledCS', False)
1155 if is_disabled_c_sharp and (self.lang == 'C#'):
1156 continue
1157 is_disabled_php = exchange.safe_bool(result, 'disabledPHP', False)
1158 if is_disabled_php and (self.lang == 'PHP'):
1159 continue
1160 if (test_name is not None) and (test_name != description):
1161 continue
1162 is_disabled_go = exchange.safe_bool(result, 'disabledGO', False)
1163 if is_disabled_go and (self.lang == 'GO'):
1164 continue
1165 is_disabled_java = exchange.safe_bool(result, 'disabledJava', False)
1166 if is_disabled_java and (self.lang == 'java'):
1167 continue
1168 skip_keys = exchange.safe_value(exchange_data, 'skipKeys', [])
1169 self.test_response_statically(exchange, method, skip_keys, result)
1170 # reset options
1171 # exchange.options = exchange.deepExtend (oldExchangeOptions, {});
1172 exchange.extend_exchange_options(exchange.deep_extend(old_exchange_options, {}))
1173 if not is_sync():
1174 close(exchange)
1175 return True # in c# methods that will be used with promiseAll need to return something
1176
1177 def get_number_of_tests_from_exchange(self, exchange, exchange_data, test_name=None):
1178 if test_name is not None:

Callers 1

run_static_testsMethod · 0.95

Calls 11

init_offline_exchangeMethod · 0.95
is_syncFunction · 0.90
closeFunction · 0.90
safe_stringMethod · 0.80
is_empty_stringMethod · 0.80
safe_valueMethod · 0.80
deep_extendMethod · 0.80
safe_boolMethod · 0.80
rangeFunction · 0.50

Tested by

no test coverage detected