コード例 #1
0
def test_invalid_data_write(sync_client):
    with pytest.raises(InfluxDBError) as e:
        # Plain invalid data
        sync_client.write(utils.random_string())
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # Pass function as input data
        sync_client.write(utils.random_string)
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # Measurement missing
        point = utils.random_point()
        point.pop('measurement')
        sync_client.write(point)
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # Non-DatetimeIndex DataFrame
        sync_client.write(utils.random_dataframe().reset_index(),
                          measurement='foo')
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # DataFrame write without specifying measurement
        sync_client.write(utils.random_dataframe())
    logger.error(e)
コード例 #2
0
ファイル: test_async.py プロジェクト: krtvand/aioinflux
async def test_chunked_query_error(async_client):
    with pytest.raises(InfluxDBError) as e:
        resp = await async_client.query('INVALID QUERY',
                                        chunked=True,
                                        chunk_size=10)
        _ = [i async for i in resp]
    logger.error(e)
コード例 #3
0
def test_invalid_output_format(sync_client):
    with pytest.raises(ValueError) as e:
        sync_client.output = utils.random_string()
    logger.error(e)
    if pd is None:
        with pytest.raises(ValueError) as e:
            sync_client.output = 'dataframe'
        logger.error(e)
コード例 #4
0
ファイル: test_dataframe.py プロジェクト: RoPP/aioinflux
def test_invalid_data_write_dataframe(sync_client):
    with pytest.raises(ValueError) as e:
        # Non-DatetimeIndex DataFrame
        sync_client.write(utils.random_dataframe().reset_index(), measurement='foo')
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # DataFrame write without specifying measurement
        sync_client.write(utils.random_dataframe())
    logger.error(e)
コード例 #5
0
def test_invalid_data_write(sync_client):
    with pytest.raises(InfluxDBWriteError) as e:
        # Plain invalid data
        sync_client.write(utils.random_string())
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # Pass function as input data
        sync_client.write(utils.random_string)
    logger.error(e)

    with pytest.raises(ValueError) as e:
        # Measurement missing
        point = utils.random_point()
        point.pop('measurement')
        sync_client.write(point)
    logger.error(e)
コード例 #6
0
def test_statement_error(sync_client):
    with pytest.raises(InfluxDBError) as e:
        sync_client.query('SELECT * FROM my_measurement', db='fake_db')
    logger.error(e)
コード例 #7
0
def test_missing_kwargs(sync_client):
    with pytest.raises(ValueError) as e:
        sync_client.select_all()
    logger.error(e)
コード例 #8
0
def test_invalid_query(sync_client):
    with pytest.raises(InfluxDBError) as e:
        sync_client.query('NOT A VALID QUERY')
    logger.error(e)
コード例 #9
0
def test_no_default_database_warning():
    with pytest.warns(UserWarning) as e:
        _ = InfluxDBClient(db=None)
    logger.error(e)
コード例 #10
0
def test_invalid_client_mode():
    with pytest.raises(ValueError) as e:
        _ = InfluxDBClient(db='mytestdb', mode=utils.random_string())
    logger.error(e)
コード例 #11
0
ファイル: test_dataframe.py プロジェクト: RoPP/aioinflux
async def test_async_chunked_dataframe(df_client):
    df_client.mode = 'async'
    with pytest.raises(ValueError) as e:
        _ = await df_client.select_all('foo', chunked=True)  # noqa: F841
    logger.error(e)
    df_client.mode = 'blocking'
コード例 #12
0
ファイル: test_dataframe.py プロジェクト: RoPP/aioinflux
def test_chunked_dataframe(df_client):
    with pytest.raises(ValueError) as e:
        _ = df_client.select_all('foo', chunked=True)  # noqa: F841
    logger.error(e)
コード例 #13
0
def test_invalid_timestamp_parsing2():
    with pytest.raises(ValueError) as e:
        _parse_timestamp({'time': 'foo'})
    logger.error(e)