Skip to content
Snippets Groups Projects
Commit 61d60b5e authored by Wernle, Alexandra Nicole's avatar Wernle, Alexandra Nicole
Browse files

Slight reformatting to residual_test.py

parent 3943856a
No related branches found
No related tags found
1 merge request!213Removed valid requirements, added valid as attribute to Absolutes, added features to handle spreadsheets that do not have 4 sets"
......@@ -55,15 +55,21 @@ def get_json_readings(filename: str):
return readings
def get_spreadsheet_absolutes(path):
def get_spreadsheet_absolutes(
observatory: str, starttime: UTCDateTime, endtime: UTCDateTime, path
):
"""
Tests functionality of SpreadsheetAbsolutesFactory and recalculation of absolutes
"""
# establish SpreadsheetAbsolutesFactory for reading test data from Excel
saf = SpreadsheetAbsolutesFactory()
saf = SpreadsheetAbsolutesFactory(base_directory=path)
# Read spreadsheet containing test data
reading = saf.parse_spreadsheet(path=path)
return reading
readings = saf.get_readings(
observatory=observatory,
starttime=UTCDateTime(starttime),
endtime=UTCDateTime(endtime),
)
return readings
def get_spreadsheet_directory_readings(path, observatory, starttime, endtime):
......@@ -100,11 +106,17 @@ def test_DED_20140952332():
Tests calculations for measurements in units of DMS.
"""
# gather absolute from DED test data and recalculate
reading = get_spreadsheet_absolutes(path="etc/residual/DED-20140952332.xlsm")
# test results with original spreadsheet values
assert_readings_equal(
expected=reading, actual=calculate(reading=reading), decimal=2
readings = get_spreadsheet_absolutes(
observatory="DED",
starttime="2014-01-01",
endtime="2014-05-01",
path="etc/residual/DED-20140952332.xlsm",
)
# test results with original spreadsheet values
for reading in readings:
assert_readings_equal(
expected=reading, actual=calculate(reading=reading), decimal=2
)
def test_BRW_20133650000():
......@@ -114,13 +126,19 @@ def test_BRW_20133650000():
Tests calculations for measurements in units of DM.
"""
# gather absolute from DED test data and recalculate
reading = get_spreadsheet_absolutes(path="etc/residual/BRW-20133650000.xlsm")
# test results with original spreadsheet values
assert_readings_equal(
expected=reading,
actual=calculate(reading=reading),
decimal=1, # change due to no longer rounding
readings = get_spreadsheet_absolutes(
observatory="BRW",
starttime="2013-01-01",
endtime="2013-12-31",
path="etc/residual/BRW-20133650000.xlsm",
)
# test results with original spreadsheet values
for reading in readings:
assert_readings_equal(
expected=reading,
actual=calculate(reading=reading),
decimal=1, # change due to no longer rounding
)
def test_BOU_20190702():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment