-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from sot/unbundle-redux
Unbundle TDB data and add testing
- Loading branch information
Showing
11 changed files
with
89 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ MANIFEST | |
dist | ||
doc/_build | ||
TDB | ||
Ska/tdb/data/ | ||
data/ | ||
*.pyc | ||
|
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
python setup.py test [With possible additional options like --addopts='-k select_tests -v -s'] | ||
|
||
python | ||
import Ska.tdb | ||
Ska.tdb.test() |
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 +1,7 @@ | ||
from .tdb import * | ||
|
||
|
||
def test(*args): | ||
"""Run self tests""" | ||
import pytest | ||
pytest.main(list(args)) |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from .. import msids, tables, set_tdb_version, get_tdb_version | ||
|
||
# Set to fixed version for regression testing | ||
TDB_VERSION = 12 | ||
set_tdb_version(TDB_VERSION) | ||
|
||
tmsrment_colnames = ( | ||
'MSID', 'TECHNICAL_NAME', 'DATA_TYPE', 'CALIBRATION_TYPE', 'ENG_UNIT', 'LOW_RAW_COUNT', | ||
'HIGH_RAW_COUNT', 'TOTAL_LENGTH', 'PROP', 'COUNTER_MSID', 'RANGE_MSID', | ||
'CALIBRATION_SWITCH_MSID', 'CALIBRATION_DEFAULT_SET_NUM', 'LIMIT_SWITCH_MSID', | ||
'LIMIT_DEFAULT_SET_NUM', 'ES_SWITCH_MSID', 'ES_DEFAULT_SET_NUM', 'OWNER_ID', | ||
'DESCRIPTION', 'EHS_HEADER_FLAG') | ||
|
||
|
||
def test_msids(): | ||
tephin = msids['tephin'] | ||
assert tephin.Tmsrment.colnames == tmsrment_colnames | ||
vals = list(tephin.Tmsrment.data) | ||
assert vals == ['TEPHIN', 'EPHIN SENSOR HOUSING TEMP', 'IUNS', 'PP', 'DEGF', 0, 255, 8, | ||
'N', '0', '0', '0', 1, '0', 1, '0', 0, 'THM', 'LR/15/PA/2', 'U'] | ||
|
||
assert tephin.Tpp.data.dtype.names == ('MSID', 'CALIBRATION_SET_NUM', 'SEQUENCE_NUM', | ||
'RAW_COUNT', 'ENG_UNIT_VALUE') | ||
|
||
vals = msids.find('teph') | ||
assert [v.msid for v in vals] == ['TEPHIN', 'TEPHTRP1', 'TEPHTRP2', 'TEPHTRR1', 'TEPHTRR2'] | ||
|
||
|
||
def test_tables(): | ||
assert sorted(tables.keys()) == ['tcntr', 'tes', 'tlmt', 'tloc', 'tmsrment', 'towner', 'tpc', | ||
'tpp', 'tsc', 'tsmpl', 'tstream', 'ttdm', 'ttdm_fmt'] | ||
|
||
tm = tables['tmsrment'] | ||
assert tm.colnames == tmsrment_colnames | ||
|
||
|
||
def test_version(): | ||
assert list(msids['tephin'].Tlmt) == ['TEPHIN', 1, 10.0, 161.0, 5.0, 999.0, 0, 5, 'A'] | ||
set_tdb_version(8) | ||
assert get_tdb_version() == 8 | ||
assert list(msids['tephin'].Tlmt) == ['TEPHIN', 1, 10.0, 81.0, 5.0, 86.0, 0, 5, 'A'] | ||
set_tdb_version(TDB_VERSION) |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[aliases] | ||
test=pytest |
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