TestAmdaDownload.py
41 lines
| 1.3 KiB
| text/x-python
|
PythonLexer
r1340 | import sys | |||
import os | ||||
if not hasattr(sys, 'argv'): | ||||
sys.argv = [''] | ||||
current_script_path = os.path.dirname(os.path.realpath(__file__)) | ||||
sys.path.append(current_script_path) | ||||
r1346 | ||||
r1340 | import pytestamda | |||
r1341 | import pysciqlopcore | |||
r1346 | ||||
import sciqlopqt | ||||
r1341 | import amda | |||
r1340 | ||||
import numpy as np | ||||
import datetime | ||||
import time | ||||
import unittest | ||||
import ddt | ||||
@ddt.ddt | ||||
class FunctionalTests(unittest.TestCase): | ||||
def setUp(self): | ||||
pass | ||||
@ddt.data( | ||||
(datetime.datetime(2012,10,20,8,10,00),datetime.datetime(2012,10,20,12,0,0)), | ||||
(datetime.datetime(2025,1,1,15,0,0),datetime.datetime(2025,1,1,16,0,0)), | ||||
(datetime.datetime(2000,1,1,0,0,0),datetime.datetime(2000,1,1,12,0,0)) | ||||
) | ||||
def test_simple_download(self, case): | ||||
tstart = case[0] | ||||
tstop = case[1] | ||||
r1341 | pytestamda.TimeController.setTime(pysciqlopcore.SqpRange(tstart, tstop)) | |||
r1346 | variable = pytestamda.VariableController.createVariable("bx_gse",pytestamda.amda_provider(), pysciqlopcore.SqpRange(tstart, tstop)) | |||
r1341 | pytestamda.VariableController.wait_for_downloads() | |||
r1340 | t_ref, x_ref, y_ref, z_ref = amda.generate_data(np.datetime64(tstart), np.datetime64(tstop), 4) | |||
r1341 | self.assertTrue( amda.compare_with_ref(variable,(t_ref, x_ref, y_ref, z_ref) ) ) | |||
r1340 | ||||
if __name__ == '__main__': | ||||
unittest.main(exit=False) | ||||