File: lcra_water_quality_test.py

package info (click to toggle)
python-ulmo 0.8.8%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,064 kB
  • sloc: python: 6,135; makefile: 144; sh: 5
file content (30 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import pandas
from ulmo.lcra.waterquality import get_sites, get_historical_data, get_recent_data
import test_util

def test_get_sites():
    data_file = 'lcra/waterquality/sites.html'
    with test_util.mocked_urls(data_file):
        sites = get_sites()

    assert len(sites['features']) == 469


def test_get_historical_data():
    parameters_file = 'lcra/waterquality/12147_params.html'
    data_file = 'lcra/waterquality/12147_results.html'

    with test_util.mocked_urls(data_file):
        results = get_historical_data(12147)

    assert len(results) == 12
    for data in results:
        assert data['Site'] == u'12147'

def test_get_recent_data():
    data_file = 'lcra/waterquality/recent_data_site_6996.html'
    with test_util.mocked_urls(data_file):
        site_data = get_recent_data('6996', as_dataframe=True)

    assert site_data.size > 0