Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
""" Test Suite | ||
""" | ||
|
||
import pytest | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath( | ||
os.path.join(os.path.dirname(__file__), '..'))) | ||
import nemreader as nr | ||
|
||
|
||
def test_correct_NMIs(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
assert len(meter_data.readings) == 1 | ||
assert 'VABD000163' in meter_data.readings | ||
|
||
def test_correct_channels(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
readings = meter_data.readings['VABD000163'] | ||
assert len(readings) == 2 | ||
assert 'E1' in readings | ||
assert 'Q1' in readings | ||
|
||
def test_correct_records(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
readings = meter_data.readings['VABD000163'] | ||
|
||
assert len(readings['E1']) == 48 | ||
assert readings['E1'][10].read_value == pytest.approx(1.11, 0.1) | ||
assert readings['E1'][-1].read_value == pytest.approx(1.11, 0.1) | ||
|
||
assert len(readings['Q1']) == 48 | ||
assert readings['Q1'][10].read_value == pytest.approx(2.22, 0.1) | ||
assert readings['Q1'][-1].read_value == pytest.approx(2.22, 0.1) | ||
assert readings['Q1'][-1].quality_method == 'A' | ||
""" Test Suite | ||
""" | ||
|
||
import pytest | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath( | ||
os.path.join(os.path.dirname(__file__), '..'))) | ||
import nemreader as nr | ||
|
||
|
||
def test_correct_NMIs(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
assert len(meter_data.readings) == 1 | ||
assert 'VABD000163' in meter_data.readings | ||
|
||
def test_correct_channels(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
readings = meter_data.readings['VABD000163'] | ||
assert len(readings) == 2 | ||
assert 'E1' in readings | ||
assert 'Q1' in readings | ||
|
||
def test_correct_records(): | ||
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv') | ||
readings = meter_data.readings['VABD000163'] | ||
|
||
assert len(readings['E1']) == 48 | ||
assert readings['E1'][10].read_value == pytest.approx(1.11, 0.1) | ||
assert readings['E1'][-1].read_value == pytest.approx(1.11, 0.1) | ||
|
||
assert len(readings['Q1']) == 48 | ||
assert readings['Q1'][10].read_value == pytest.approx(2.22, 0.1) | ||
assert readings['Q1'][-1].read_value == pytest.approx(2.22, 0.1) | ||
assert readings['Q1'][-1].quality_method == 'A' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,16 @@ | ||
[tox] | ||
envlist = | ||
py{34,36}, | ||
coverage, | ||
skip_missing_interpreters = | ||
true | ||
|
||
[testenv] | ||
# Default environment | ||
deps = | ||
-r{toxinidir}/requirements.txt | ||
pytest | ||
pytest-sugar | ||
pytest-xdist | ||
commands = | ||
py.test | ||
|
||
[testenv:coverage] | ||
# Generates coverage report | ||
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH | ||
deps = | ||
-r{toxinidir}/requirements.txt | ||
pytest | ||
pytest-sugar | ||
pytest-cov | ||
commands = | ||
py.test --cov-report term-missing --cov=nemreader tests/ | ||
py.test -v --cov=nemreader |