code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def test_write_points_with_precision(self):
"""Test write points with precision for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/write",
status_code=204
)... | Test write points with precision for TestInfluxDBClient object. | test_write_points_with_precision | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_write_points_with_consistency(self):
"""Test write points with consistency for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
'http://localhost:8086/write',
status_code=204
... | Test write points with consistency for TestInfluxDBClient object. | test_write_points_with_consistency | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_write_points_bad_precision(self):
"""Test write points w/bad precision TestInfluxDBClient object."""
cli = InfluxDBClient()
with self.assertRaisesRegexp(
Exception,
"Invalid time precision is given. "
"\(use 'n', 'u', 'ms', 's', 'm' or 'h'\)"
... | Test write points w/bad precision TestInfluxDBClient object. | test_write_points_bad_precision | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_write_points_bad_consistency(self):
"""Test write points w/bad consistency value."""
cli = InfluxDBClient()
with self.assertRaises(ValueError):
cli.write_points(
self.dummy_points,
consistency='boo'
) | Test write points w/bad consistency value. | test_write_points_bad_consistency | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_write_points_with_precision_fails(self):
"""Test write points w/precision fail for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
with _mocked_session(cli, 'post', 500):
cli.write_points_with_precision([]) | Test write points w/precision fail for TestInfluxDBClient object. | test_write_points_with_precision_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_query(self):
"""Test query method for TestInfluxDBClient object."""
example_response = (
'{"results": [{"series": [{"measurement": "sdfsdfsdf", '
'"columns": ["time", "value"], "values": '
'[["2009-11-10T23:00:00Z", 0.64]]}]}, {"series": '
'[{"mea... | Test query method for TestInfluxDBClient object. | test_query | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_query_msgpack(self):
"""Test query method with a messagepack response."""
example_response = bytes(bytearray.fromhex(
"81a7726573756c74739182ac73746174656d656e745f696400a673657269"
"65739183a46e616d65a161a7636f6c756d6e7392a474696d65a176a67661"
"6c7565739192c7... | Test query method with a messagepack response. | test_query_msgpack | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_query_chunked(self):
"""Test chunked query for TestInfluxDBClient object."""
cli = InfluxDBClient(database='db')
example_object = {
'points': [
[1415206250119, 40001, 667],
[1415206244555, 30001, 7],
[1415206228241, 20001, 788]... | Test chunked query for TestInfluxDBClient object. | test_query_chunked | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_query_fail(self):
"""Test query failed for TestInfluxDBClient object."""
with _mocked_session(self.cli, 'get', 401):
self.cli.query('select column_one from foo;') | Test query failed for TestInfluxDBClient object. | test_query_fail | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_database(self):
"""Test create database for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text='{"results":[{}]}'
)
sel... | Test create database for TestInfluxDBClient object. | test_create_database | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_numeric_named_database(self):
"""Test create db w/numeric name for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text='{"results":[{}]}'
... | Test create db w/numeric name for TestInfluxDBClient object. | test_create_numeric_named_database | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_drop_database(self):
"""Test drop database for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text='{"results":[{}]}'
)
self.cl... | Test drop database for TestInfluxDBClient object. | test_drop_database | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_drop_measurement(self):
"""Test drop measurement for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text='{"results":[{}]}'
)
s... | Test drop measurement for TestInfluxDBClient object. | test_drop_measurement | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_drop_numeric_named_database(self):
"""Test drop numeric db for TestInfluxDBClient object."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text='{"results":[{}]}'
)
... | Test drop numeric db for TestInfluxDBClient object. | test_drop_numeric_named_database | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_database(self):
"""Test get list of databases for TestInfluxDBClient object."""
data = {'results': [
{'series': [
{'name': 'databases',
'values': [
['new_db_1'],
['new_db_2']],
'colu... | Test get list of databases for TestInfluxDBClient object. | test_get_list_database | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_database_fails(self):
"""Test get list of dbs fail for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 401):
cli.get_list_database() | Test get list of dbs fail for TestInfluxDBClient object. | test_get_list_database_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_measurements(self):
"""Test get list of measurements for TestInfluxDBClient object."""
data = {
"results": [{
"series": [
{"name": "measurements",
"columns": ["name"],
"values": [["cpu"], ["disk"]... | Test get list of measurements for TestInfluxDBClient object. | test_get_list_measurements | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_series(self):
"""Test get a list of series from the database."""
data = {'results': [
{'series': [
{
'values': [
['cpu_load_short,host=server01,region=us-west'],
['memory_usage,host=server02... | Test get a list of series from the database. | test_get_list_series | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_series_with_measurement(self):
"""Test get a list of series from the database by filter."""
data = {'results': [
{'series': [
{
'values': [
['cpu_load_short,host=server01,region=us-west']],
'col... | Test get a list of series from the database by filter. | test_get_list_series_with_measurement | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_series_with_tags(self):
"""Test get a list of series from the database by tags."""
data = {'results': [
{'series': [
{
'values': [
['cpu_load_short,host=server01,region=us-west']],
'columns': ['... | Test get a list of series from the database by tags. | test_get_list_series_with_tags | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_series_fails(self):
"""Test get a list of series from the database but fail."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 401):
cli.get_list_series() | Test get a list of series from the database but fail. | test_get_list_series_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_retention_policy_default(self):
"""Test create default ret policy for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/quer... | Test create default ret policy for TestInfluxDBClient object. | test_create_retention_policy_default | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_retention_policy(self):
"""Test create retention policy for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
... | Test create retention policy for TestInfluxDBClient object. | test_create_retention_policy | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_retention_policy_shard_duration(self):
"""Test create retention policy with a custom shard duration."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/... | Test create retention policy with a custom shard duration. | test_create_retention_policy_shard_duration | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_retention_policy_shard_duration_default(self):
"""Test create retention policy with a default shard duration."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localh... | Test create retention policy with a default shard duration. | test_create_retention_policy_shard_duration_default | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_alter_retention_policy(self):
"""Test alter retention policy for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
... | Test alter retention policy for TestInfluxDBClient object. | test_alter_retention_policy | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_alter_retention_policy_invalid(self):
"""Test invalid alter ret policy for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 400):
self.cli.alter_retention_policy('somename', 'db') | Test invalid alter ret policy for TestInfluxDBClient object. | test_alter_retention_policy_invalid | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_drop_retention_policy(self):
"""Test drop retention policy for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
... | Test drop retention policy for TestInfluxDBClient object. | test_drop_retention_policy | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_drop_retention_policy_fails(self):
"""Test failed drop ret policy for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'delete', 401):
cli.drop_retention_policy('default', 'db') | Test failed drop ret policy for TestInfluxDBClient object. | test_drop_retention_policy_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_retention_policies(self):
"""Test get retention policies for TestInfluxDBClient object."""
example_response = \
'{"results": [{"series": [{"values": [["fsfdsdf", "24h0m0s", 2]],'\
' "columns": ["name", "duration", "replicaN"]}]}]}'
with requests_mock.Mo... | Test get retention policies for TestInfluxDBClient object. | test_get_list_retention_policies | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_request_retry(self, mock_request):
"""Test that two connection errors will be handled."""
class CustomMock(object):
"""Create custom mock object for test."""
def __init__(self):
self.i = 0
def connection_error(self, *args, **kwargs):
... | Test that two connection errors will be handled. | test_request_retry | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def connection_error(self, *args, **kwargs):
"""Handle a connection error for the CustomMock object."""
self.i += 1
if self.i < 3:
raise requests.exceptions.ConnectionError
r = requests.Response()
r.status_code = 204
... | Handle a connection error for the CustomMock object. | connection_error | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_request_retry_raises(self, mock_request):
"""Test that three requests errors will not be handled."""
class CustomMock(object):
"""Create custom mock object for test."""
def __init__(self):
self.i = 0
def connection_error(self, *args, **kwarg... | Test that three requests errors will not be handled. | test_request_retry_raises | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_random_request_retry(self, mock_request):
"""Test that a random number of connection errors will be handled."""
class CustomMock(object):
"""Create custom mock object for test."""
def __init__(self, retries):
self.i = 0
self.retries = ret... | Test that a random number of connection errors will be handled. | test_random_request_retry | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_random_request_retry_raises(self, mock_request):
"""Test a random number of conn errors plus one will not be handled."""
class CustomMock(object):
"""Create custom mock object for test."""
def __init__(self, retries):
self.i = 0
self.retr... | Test a random number of conn errors plus one will not be handled. | test_random_request_retry_raises | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_users(self):
"""Test get users for TestInfluxDBClient object."""
example_response = (
'{"results":[{"series":[{"columns":["user","admin"],'
'"values":[["test",false]]}]}]}'
)
with requests_mock.Mocker() as m:
m.register_uri(
... | Test get users for TestInfluxDBClient object. | test_get_list_users | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_users_empty(self):
"""Test get empty userlist for TestInfluxDBClient object."""
example_response = (
'{"results":[{"series":[{"columns":["user","admin"]}]}]}'
)
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.GET,
... | Test get empty userlist for TestInfluxDBClient object. | test_get_list_users_empty | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_grant_admin_privileges(self):
"""Test grant admin privs for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
... | Test grant admin privs for TestInfluxDBClient object. | test_grant_admin_privileges | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_grant_admin_privileges_invalid(self):
"""Test grant invalid admin privs for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 400):
self.cli.grant_admin_privileges('') | Test grant invalid admin privs for TestInfluxDBClient object. | test_grant_admin_privileges_invalid | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_revoke_admin_privileges(self):
"""Test revoke admin privs for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
... | Test revoke admin privs for TestInfluxDBClient object. | test_revoke_admin_privileges | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_revoke_admin_privileges_invalid(self):
"""Test revoke invalid admin privs for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 400):
self.cli.revoke_admin_privileges('') | Test revoke invalid admin privs for TestInfluxDBClient object. | test_revoke_admin_privileges_invalid | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_grant_privilege(self):
"""Test grant privs for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text=examp... | Test grant privs for TestInfluxDBClient object. | test_grant_privilege | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_grant_privilege_invalid(self):
"""Test grant invalid privs for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 400):
self.cli.grant_privilege('', 'testdb', 'test') | Test grant invalid privs for TestInfluxDBClient object. | test_grant_privilege_invalid | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_revoke_privilege(self):
"""Test revoke privs for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text=exa... | Test revoke privs for TestInfluxDBClient object. | test_revoke_privilege | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_revoke_privilege_invalid(self):
"""Test revoke invalid privs for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 400):
self.cli.revoke_privilege('', 'testdb', 'test') | Test revoke invalid privs for TestInfluxDBClient object. | test_revoke_privilege_invalid | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_privileges(self):
"""Test get list of privs for TestInfluxDBClient object."""
data = {'results': [
{'series': [
{'columns': ['database', 'privilege'],
'values': [
['db1', 'READ'],
['db2', 'ALL PRIVIL... | Test get list of privs for TestInfluxDBClient object. | test_get_list_privileges | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_privileges_fails(self):
"""Test failed get list of privs for TestInfluxDBClient object."""
cli = InfluxDBClient('host', 8086, 'username', 'password')
with _mocked_session(cli, 'get', 401):
cli.get_list_privileges('test') | Test failed get list of privs for TestInfluxDBClient object. | test_get_list_privileges_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_get_list_continuous_queries(self):
"""Test getting a list of continuous queries."""
data = {
"results": [
{
"statement_id": 0,
"series": [
{
"name": "testdb01",
... | Test getting a list of continuous queries. | test_get_list_continuous_queries | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_create_continuous_query_fails(self):
"""Test failing to create a continuous query."""
with _mocked_session(self.cli, 'get', 400):
self.cli.create_continuous_query('cq_name', 'select', 'db_name') | Test failing to create a continuous query. | test_create_continuous_query_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_invalid_port_fails(self):
"""Test invalid port fail for TestInfluxDBClient object."""
with self.assertRaises(ValueError):
InfluxDBClient('host', '80/redir', 'username', 'password') | Test invalid port fail for TestInfluxDBClient object. | test_invalid_port_fails | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_chunked_response(self):
"""Test chunked response for TestInfluxDBClient object."""
example_response = \
u'{"results":[{"statement_id":0,"series":[{"columns":["key"],' \
'"values":[["cpu"],["memory"],["iops"],["network"]],"partial":' \
'true}],"partial":true}]... | Test chunked response for TestInfluxDBClient object. | test_chunked_response | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_auth_username_password(self):
"""Test auth with custom username and password."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.GET,
"http://localhost:8086/ping",
status_code=204,
headers={'X-Influxdb-V... | Test auth with custom username and password. | test_auth_username_password | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_auth_username_password_none(self):
"""Test auth with not defined username or password."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.GET,
"http://localhost:8086/ping",
status_code=204,
headers={'X-I... | Test auth with not defined username or password. | test_auth_username_password_none | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_auth_token(self):
"""Test auth with custom authorization header."""
with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.GET,
"http://localhost:8086/ping",
status_code=204,
headers={'X-Influxdb-Version': '1.2... | Test auth with custom authorization header. | test_auth_token | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def query(self,
query,
params=None,
expected_response_code=200,
database=None):
"""Query data from the FakeClient object."""
if query == 'Fail':
raise Exception("Fail")
elif query == 'Fail once' and self._host == 'host1':
... | Query data from the FakeClient object. | query | python | influxdata/influxdb-python | influxdb/tests/client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py | MIT |
def test_write_points_from_dataframe(self):
"""Test write points from df in TestDataFrameClient object."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[now, now + timedelta(hours=1)],
... | Test write points from df in TestDataFrameClient object. | test_write_points_from_dataframe | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_dataframe_write_points_with_whitespace_measurement(self):
"""write_points should escape white space in measurements."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[now, now + timedelta... | write_points should escape white space in measurements. | test_dataframe_write_points_with_whitespace_measurement | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_dataframe_write_points_with_whitespace_in_column_names(self):
"""write_points should escape white space in column names."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[now, now + timed... | write_points should escape white space in column names. | test_dataframe_write_points_with_whitespace_in_column_names | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_in_batches(self):
"""Test write points in batch from df in TestDataFrameClient object."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[now, now + timedelta(h... | Test write points in batch from df in TestDataFrameClient object. | test_write_points_from_dataframe_in_batches | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tag_columns(self):
"""Test write points from df w/tag in TestDataFrameClient object."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, 1.0],
['red', 0, "2", 2, 2.0]],... | Test write points from df w/tag in TestDataFrameClient object. | test_write_points_from_dataframe_with_tag_columns | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tag_cols_and_global_tags(self):
"""Test write points from df w/tag + cols in TestDataFrameClient."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, 1.0],
['red', 0, "... | Test write points from df w/tag + cols in TestDataFrameClient. | test_write_points_from_dataframe_with_tag_cols_and_global_tags | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tag_cols_and_defaults(self):
"""Test default write points from df w/tag in TestDataFrameClient."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, 1.0, 'hot'],
['red',... | Test default write points from df w/tag in TestDataFrameClient. | test_write_points_from_dataframe_with_tag_cols_and_defaults | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tag_escaped(self):
"""Test write points from df w/escaped tag in TestDataFrameClient."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(
data=[
['blue orange', "1", 1, 'hot=cold'], # space, equal
... | Test write points from df w/escaped tag in TestDataFrameClient. | test_write_points_from_dataframe_with_tag_escaped | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_numeric_column_names(self):
"""Test write points from df with numeric cols."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
# df with numeric column names
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
... | Test write points from df with numeric cols. | test_write_points_from_dataframe_with_numeric_column_names | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_leading_none_column(self):
"""write_points detect erroneous leading comma for null first field."""
dataframe = pd.DataFrame(
dict(
first=[1, None, None, 8, 9],
second=[2, None, None, None, 10],
third=[3... | write_points detect erroneous leading comma for null first field. | test_write_points_from_dataframe_with_leading_none_column | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_numeric_precision(self):
"""Test write points from df with numeric precision."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
# df with numeric column names
dataframe = pd.DataFrame(data=[["1", 1, 1.1111111111111],
... | Test write points from df with numeric precision. | test_write_points_from_dataframe_with_numeric_precision | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_period_index(self):
"""Test write points from df with period index."""
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[pd.Period('1970-01-01'),
pd.Period('1970-01-02')]... | Test write points from df with period index. | test_write_points_from_dataframe_with_period_index | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_time_precision(self):
"""Test write points from df with time precision."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
index=[now, now + timedelta(hours=1)],
... | Test write points from df with time precision. | test_write_points_from_dataframe_with_time_precision | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_fails_without_time_index(self):
"""Test failed write points from df without time index."""
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
columns=["column_one", "column_two",
"c... | Test failed write points from df without time index. | test_write_points_from_dataframe_fails_without_time_index | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_fails_with_series(self):
"""Test failed write points from df with series."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.Series(data=[1.0, 2.0],
index=[now, now + timedelta(hours=1)])
with requests_mock.M... | Test failed write points from df with series. | test_write_points_from_dataframe_fails_with_series | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_create_database_fails(self):
"""Test create database fail for TestInfluxDBClient object."""
cli = DataFrameClient(database='db')
with _mocked_session(cli, 'post', 401):
cli.create_database('new_db') | Test create database fail for TestInfluxDBClient object. | test_create_database_fails | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_query_into_dataframe(self):
"""Test query into df for TestDataFrameClient object."""
data = {
"results": [{
"series": [
{"measurement": "network",
"tags": {"direction": ""},
"columns": ["time", "value"],
... | Test query into df for TestDataFrameClient object. | test_query_into_dataframe | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_multiquery_into_dataframe(self):
"""Test multiquery into df for TestDataFrameClient object."""
data = {
"results": [
{
"series": [
{
"name": "cpu_load_short",
"columns... | Test multiquery into df for TestDataFrameClient object. | test_multiquery_into_dataframe | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_query_with_empty_result(self):
"""Test query with empty results in TestDataFrameClient object."""
cli = DataFrameClient('host', 8086, 'username', 'password', 'db')
with _mocked_session(cli, 'GET', 200, {"results": [{}]}):
result = cli.query('select column_one from foo;')
... | Test query with empty results in TestDataFrameClient object. | test_query_with_empty_result | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_get_list_database(self):
"""Test get list of databases in TestDataFrameClient object."""
data = {'results': [
{'series': [
{'measurement': 'databases',
'values': [
['new_db_1'],
['new_db_2']],
... | Test get list of databases in TestDataFrameClient object. | test_get_list_database | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_datetime_to_epoch(self):
"""Test convert datetime to epoch in TestDataFrameClient object."""
timestamp = pd.Timestamp('2013-01-01 00:00:00.000+00:00')
cli = DataFrameClient('host', 8086, 'username', 'password', 'db')
self.assertEqual(
cli._datetime_to_epoch(timestam... | Test convert datetime to epoch in TestDataFrameClient object. | test_datetime_to_epoch | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_dsn_constructor(self):
"""Test data source name deconstructor in TestDataFrameClient."""
client = DataFrameClient.from_dsn('influxdb://localhost:8086')
self.assertIsInstance(client, DataFrameClient)
self.assertEqual('http://localhost:8086', client._baseurl) | Test data source name deconstructor in TestDataFrameClient. | test_dsn_constructor | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_nan_line(self):
"""Test write points from dataframe with Nan lines."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, np.inf], ["2", 2, np.nan]],
index=[now, now + timedelta(hours=1)]... | Test write points from dataframe with Nan lines. | test_write_points_from_dataframe_with_nan_line | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_nan_json(self):
"""Test write points from json with NaN lines."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[["1", 1, np.inf], ["2", 2, np.nan]],
index=[now, now + timedelta(hours=1)],
... | Test write points from json with NaN lines. | test_write_points_from_dataframe_with_nan_json | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tags_and_nan_line(self):
"""Test write points from dataframe with NaN lines and tags."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, np.inf],
['red', 0, "2", 2, np... | Test write points from dataframe with NaN lines and tags. | test_write_points_from_dataframe_with_tags_and_nan_line | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_write_points_from_dataframe_with_tags_and_nan_json(self):
"""Test write points from json with NaN lines and tags."""
now = pd.Timestamp('1970-01-01 00:00+00:00')
dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, np.inf],
['red', 0, "2", 2, np.nan]... | Test write points from json with NaN lines and tags. | test_write_points_from_dataframe_with_tags_and_nan_json | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def test_dataframe_nanosecond_precision_one_microsecond(self):
"""Test nanosecond precision within one microsecond."""
# 1 microsecond = 1000 nanoseconds
start = np.datetime64('2019-10-04T06:27:19.850557000')
end = np.datetime64('2019-10-04T06:27:19.850558000')
# generate timest... | Test nanosecond precision within one microsecond. | test_dataframe_nanosecond_precision_one_microsecond | python | influxdata/influxdb-python | influxdb/tests/dataframe_client_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/dataframe_client_test.py | MIT |
def setUp(self):
"""Check that MySeriesHelper has empty datapoints."""
super(TestSeriesHelper, self).setUp()
self.assertEqual(
TestSeriesHelper.MySeriesHelper._json_body_(),
[],
'Resetting helper in teardown did not empty datapoints.') | Check that MySeriesHelper has empty datapoints. | setUp | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def test_auto_commit(self):
"""Test write_points called after valid number of events."""
class AutoCommitTest(SeriesHelper):
"""Define a SeriesHelper instance to test autocommit."""
class Meta:
"""Define metadata for AutoCommitTest."""
series_nam... | Test write_points called after valid number of events. | test_auto_commit | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSingleSeriesName(self, current_timestamp):
"""Test JSON conversion when there is only one series name."""
current_timestamp.return_value = current_date = datetime.today()
TestSeriesHelper.MySeriesHelper(
server_name='us.east-1', other_tag='ello', some_stat=159)
TestSe... | Test JSON conversion when there is only one series name. | testSingleSeriesName | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeveralSeriesNames(self, current_timestamp):
"""Test JSON conversion when there are multiple series names."""
current_timestamp.return_value = current_date = datetime.today()
TestSeriesHelper.MySeriesHelper(
server_name='us.east-1', some_stat=159, other_tag='ello')
Te... | Test JSON conversion when there are multiple series names. | testSeveralSeriesNames | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeriesWithoutTimeField(self, current_timestamp):
"""Test that time is optional on a series without a time field."""
current_date = datetime.today()
yesterday = current_date - timedelta(days=1)
current_timestamp.return_value = yesterday
TestSeriesHelper.MySeriesHelper(
... | Test that time is optional on a series without a time field. | testSeriesWithoutTimeField | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeriesWithoutAllTags(self):
"""Test that creating a data point without a tag throws an error."""
class MyTimeFieldSeriesHelper(SeriesHelper):
class Meta:
client = TestSeriesHelper.client
series_name = 'events.stats.{server_name}'
field... | Test that creating a data point without a tag throws an error. | testSeriesWithoutAllTags | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeriesWithTimeField(self, current_timestamp):
"""Test that time is optional on a series with a time field."""
current_date = datetime.today()
yesterday = current_date - timedelta(days=1)
current_timestamp.return_value = yesterday
class MyTimeFieldSeriesHelper(SeriesHelpe... | Test that time is optional on a series with a time field. | testSeriesWithTimeField | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testWarnBulkSizeZero(self):
"""Test warning for an invalid bulk size."""
class WarnBulkSizeZero(SeriesHelper):
class Meta:
client = TestSeriesHelper.client
series_name = 'events.stats.{server_name}'
fields = ['time', 'server_name']
... | Test warning for an invalid bulk size. | testWarnBulkSizeZero | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeriesWithRetentionPolicy(self):
"""Test that the data is saved with the specified retention policy."""
my_policy = 'my_policy'
class RetentionPolicySeriesHelper(SeriesHelper):
class Meta:
client = InfluxDBClient()
series_name = 'events.stats... | Test that the data is saved with the specified retention policy. | testSeriesWithRetentionPolicy | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def testSeriesWithoutRetentionPolicy(self):
"""Test that the data is saved without any retention policy."""
class NoRetentionPolicySeriesHelper(SeriesHelper):
class Meta:
client = InfluxDBClient()
series_name = 'events.stats.{server_name}'
fie... | Test that the data is saved without any retention policy. | testSeriesWithoutRetentionPolicy | python | influxdata/influxdb-python | influxdb/tests/helper_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/helper_test.py | MIT |
def get_free_ports(num_ports, ip='127.0.0.1'):
"""Determine free ports on provided interface.
Get `num_ports` free/available ports on the interface linked to the `ip`
:param int num_ports: The number of free ports to get
:param str ip: The ip on which the ports have to be taken
:return: a set of po... | Determine free ports on provided interface.
Get `num_ports` free/available ports on the interface linked to the `ip`
:param int num_ports: The number of free ports to get
:param str ip: The ip on which the ports have to be taken
:return: a set of ports number
| get_free_ports | python | influxdata/influxdb-python | influxdb/tests/misc.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/misc.py | MIT |
def is_port_open(port, ip='127.0.0.1'):
"""Check if given TCP port is open for connection."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
result = sock.connect_ex((ip, port))
if not result:
sock.shutdown(socket.SHUT_RDWR)
return result == 0
finally:
... | Check if given TCP port is open for connection. | is_port_open | python | influxdata/influxdb-python | influxdb/tests/misc.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/misc.py | MIT |
def setUp(self):
"""Set up an instance of TestResultSet."""
self.query_response = {
"results": [
{"series": [{"name": "cpu_load_short",
"columns": ["time", "value", "host", "region"],
"values": [
... | Set up an instance of TestResultSet. | setUp | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
def test_filter_by_name(self):
"""Test filtering by name in TestResultSet object."""
expected = [
{'value': 0.64,
'time': '2015-01-29T21:51:28.968422294Z',
'host': 'server01',
'region': 'us-west'},
{'value': 0.65,
't... | Test filtering by name in TestResultSet object. | test_filter_by_name | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
def test_filter_by_tags(self):
"""Test filter by tags in TestResultSet object."""
expected = [
{'value': 0.64,
'time': '2015-01-29T21:51:28.968422294Z',
'host': 'server01',
'region': 'us-west'},
{'value': 0.66,
'time... | Test filter by tags in TestResultSet object. | test_filter_by_tags | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
def test_filter_by_name_and_tags(self):
"""Test filter by name and tags in TestResultSet object."""
self.assertEqual(
list(self.rs[('cpu_load_short', {"host": "server01"})]),
[{'value': 0.64,
'time': '2015-01-29T21:51:28.968422294Z',
'host': 'serve... | Test filter by name and tags in TestResultSet object. | test_filter_by_name_and_tags | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
def test_point_from_cols_vals(self):
"""Test points from columns in TestResultSet object."""
cols = ['col1', 'col2']
vals = [1, '2']
point = ResultSet.point_from_cols_vals(cols, vals)
self.assertDictEqual(
point,
{'col1': 1, 'col2': '2'}
) | Test points from columns in TestResultSet object. | test_point_from_cols_vals | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
def test_system_query(self):
"""Test system query capabilities in TestResultSet object."""
rs = ResultSet(
{'series': [
{'values': [['another', '48h0m0s', 3, False],
['default', '0', 1, False],
['somename', '24h0m0s', 4,... | Test system query capabilities in TestResultSet object. | test_system_query | python | influxdata/influxdb-python | influxdb/tests/resultset_test.py | https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/resultset_test.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.