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

Method test_method

python/ccxt/test/tests_async.py:190–236  ·  view source on GitHub ↗
(self, method_name, exchange, args, is_public)

Source from the content-addressed store, hash-verified

188 return message + res
189
190 async def test_method(self, method_name, exchange, args, is_public):
191 # todo: temporary skip for c#
192 if 'OrderBook' in method_name and self.ext == 'cs':
193 exchange.options['checksum'] = False
194 # todo: temporary skip for php
195 if 'OrderBook' in method_name and self.ext == 'php':
196 return True
197 skipped_properties_for_method = self.get_skips(exchange, method_name)
198 is_load_markets = (method_name == 'loadMarkets')
199 is_fetch_currencies = (method_name == 'fetchCurrencies')
200 is_proxy_test = (method_name == self.proxy_test_file_name)
201 is_constructor_test = (method_name == 'afterConstruct')
202 is_feature_test = (method_name == 'features')
203 # if this is a private test, and the implementation was already tested in public, then no need to re-test it in private test (exception is fetchCurrencies, because our approach in base exchange)
204 if not is_public and (method_name in self.checked_public_tests) and not is_fetch_currencies:
205 return True
206 skip_message = None
207 supported_by_exchange = (method_name in exchange.has) and exchange.has[method_name]
208 if not is_load_markets and (len(self.only_specific_tests) > 0 and not exchange.in_array(method_name, self.only_specific_tests)):
209 skip_message = '[INFO] IGNORED_TEST'
210 elif not is_load_markets and not supported_by_exchange and not is_proxy_test and not is_feature_test and not is_constructor_test:
211 skip_message = '[INFO] UNSUPPORTED_TEST' # keep it aligned with the longest message
212 elif isinstance(skipped_properties_for_method, str):
213 skip_message = '[INFO] SKIPPED_TEST'
214 elif not (method_name in self.test_files):
215 skip_message = '[INFO] UNIMPLEMENTED_TEST'
216 # exceptionally for `loadMarkets` call, we call it before it's even checked for "skip" as we need it to be called anyway (but can skip "test.loadMarket" for it)
217 if is_load_markets:
218 await exchange.load_markets(True)
219 name = exchange.id
220 if skip_message:
221 if self.info:
222 dump(self.add_padding(skip_message, 25), name, method_name)
223 return True
224 if self.info:
225 args_stringified = '(' + exchange.json(args) + ')' # args.join() breaks when we provide a list of symbols or multidimensional array; "args.toString()" breaks bcz of "array to string conversion"
226 dump(self.add_padding('[INFO] TESTING', 25), name, method_name, args_stringified)
227 if is_sync():
228 call_method_sync(self.test_files, method_name, exchange, skipped_properties_for_method, args)
229 else:
230 await call_method(self.test_files, method_name, exchange, skipped_properties_for_method, args)
231 if self.info:
232 dump(self.add_padding('[INFO] TESTING DONE', 25), name, method_name)
233 # add to the list of successed tests
234 if is_public:
235 self.checked_public_tests[method_name] = True
236 return True
237
238 def get_skips(self, exchange, method_name):
239 final_skips = {}

Callers 2

test_safeMethod · 0.95
test_proxiesMethod · 0.95

Calls 9

get_skipsMethod · 0.95
add_paddingMethod · 0.95
dumpFunction · 0.90
is_syncFunction · 0.90
call_method_syncFunction · 0.90
call_methodFunction · 0.90
in_arrayMethod · 0.80
load_marketsMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected