def test_every_exchange(event_loop): async def wrapper(): async with AsyncPymarketcap(**asyncparms) as apym: show_msg = True async for exc in apym.every_exchange(): if show_msg: print("Testing all responses...") show_msg = False res.append(exc) assert_types(exc) assert_consistence(exc) assert isinstance(res, list) with open(cache_file, "w") as f: f.write(json.dumps(res, ensure_ascii=False)) if os.path.exists(cache_file): with open(cache_file, "r") as f: for curr in json.loads(f.read()): res.append(curr) assert isinstance(res, list) for currency in res: assert_types(currency) assert_consistence(currency) else: event_loop.run_until_complete(wrapper())
def test_convert(): exc = random_exchange(pym)["website_slug"] print('(<exchange>["website_slug"] == "%s")' % exc, end=" ") res = pym.exchange(exc, convert="BTC") assert_types(res) assert_consistence(res)
def test_convert(): exc = choice(pym.exchange_slugs) print("(Exchange: %s)" % exc, end=" ") res = pym.exchange(exc, convert="BTC") assert_types(res) assert_consistence(res)
async def wrapper(): async with AsyncPymarketcap(**asyncparms) as apym: show_msg = True async for exc in apym.every_exchange(): if show_msg: print("Testing all responses...") show_msg = False res.append(exc) assert_types(exc) assert_consistence(exc) assert isinstance(res, list) with open(cache_file, "w") as f: f.write(json.dumps(res, ensure_ascii=False))
async def wrapper(): async with AsyncPymarketcap(debug=True, queue_size=50, consumers=50) as apym: res = [] show_msg = True async for exc in apym.every_exchange(): if show_msg: print("Testing all responses...") show_msg = False res.append(exc) assert_types(exc) assert_consistence(exc) assert type(res) == list
def test_consistence(): exc = random_exchange(pym)["website_slug"] print('(<exchange>["website_slug"] == "%s")' % exc, end=" ") res = pym.exchange(exc) assert_consistence(res) assert_number_of_markets(res)
def test_consistence(): exc = choice(pym.exchange_slugs) print("(Exchange: %s)" % exc, end=" ") res = pym.exchange(exc) assert_consistence(res) assert_number_of_markets(res)