示例#1
0
def test_every_historical(event_loop):
    async def wrapper():
        async with AsyncPymarketcap(**asyncparms) as apym:
            show_msg = True
            async for (currency) in apym.every_historical():
                if show_msg:
                    print("Testing all responses...")
                    show_msg = False
                res.append(currency)

                assert_types(currency)
                assert_consistence(currency)
            assert isinstance(res, list)

    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())
示例#2
0
    async def wrapper():
        async with AsyncPymarketcap(**asyncparms) as apym:
            show_msg = True
            async for (currency) in apym.every_historical():
                if show_msg:
                    print("Testing all responses...")
                    show_msg = False
                res.append(currency)

                assert_types(currency)
                assert_consistence(currency)
            assert isinstance(res, list)
    async def wrapper():
        async with AsyncPymarketcap(debug=True, queue_size=50,
                                    consumers=50) as apym:
            res = []
            show_msg = True
            async for (currency) in apym.every_historical():
                if show_msg:
                    print("Testing all responses...")
                    show_msg = False
                res.append(currency)

                assert_types(currency)
                assert_consistence(currency)
            assert type(res) == list
示例#4
0
def test_consistence():
    coin = choice(pym.coins)
    print("(Currency: %s)" % coin, end=" ")
    res = pym.historical(coin)
    assert_consistence(res)
示例#5
0
def test_consistence():
    curr = random_cryptocurrency(pym)["website_slug"]
    print('(<currency>["website_slug"] == "%s")' % curr, end=" ")
    res = pym.historical(curr)
    assert_consistence(res)