コード例 #1
0
def test_moving_min_of_all_measurements(sample_data, sample_measurement,
                                        sample_database, database_with_data):
    database_client = DatabaseClient(database_with_data,
                                     db_name=sample_database)
    expected = min(sample_data)
    actual = database_client.moving_min(
        sample_measurement, time_window='{}s'.format(len(sample_data) + 1))
    assert expected == actual
コード例 #2
0
def test_moving_min_of_last_3_measurements(sample_data, sample_measurement,
                                           sample_database,
                                           database_with_data):
    database_client = DatabaseClient(database_with_data,
                                     db_name=sample_database)
    expected = min(sample_data[-3:])
    actual = database_client.moving_min(sample_measurement, time_window='4s')
    assert expected == actual
コード例 #3
0
def test_moving_min_without_measurements(sample_measurement, sample_database,
                                         database):
    database_client = DatabaseClient(database, db_name=sample_database)
    with pytest.raises(RuntimeError):
        database_client.moving_min(sample_measurement, time_window='0s')