コード例 #1
0
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())
コード例 #2
0
ファイル: test_exchange.py プロジェクト: TrongDev/pymarketcap
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)
コード例 #3
0
ファイル: test_exchange.py プロジェクト: Bragegs/pymarketcap
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)
コード例 #4
0
    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))
コード例 #5
0
    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
コード例 #6
0
ファイル: test_exchange.py プロジェクト: TrongDev/pymarketcap
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)
コード例 #7
0
ファイル: test_exchange.py プロジェクト: Bragegs/pymarketcap
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)