1- """Tests util.py that interact with timestream """
1+ """Tests for swxsoc.db.timeseries (Timestream recording functions) """
22
33import os
44
1111from moto .core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
1212from moto .timestreamwrite .models import timestreamwrite_backends
1313
14- from swxsoc .util import util
14+ from swxsoc .db import timeseries
1515
1616
1717def get_test_db_names ():
@@ -77,7 +77,7 @@ def test_record_timeseries_quantity_1col(mocked_timestream):
7777 meta = {"name" : timeseries_name },
7878 )
7979 ts ["temp4" ] = [1.0 , 4.0 , 5.0 , 6.0 , 4.0 ] * u .deg_C
80- util .record_timeseries (ts , instrument_name = "test" )
80+ timeseries .record_timeseries (ts , instrument_name = "test" )
8181
8282 database_name , table_name = get_test_db_names ()
8383 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -115,7 +115,7 @@ def test_record_timeseries_quantity_1col_array(mocked_timestream):
115115 meta = {"name" : timeseries_name },
116116 )
117117 ts ["temp4_arr" ] = np .arange (6 * 5 ).reshape ((5 , 6 ))
118- util .record_timeseries (ts , instrument_name = "test" )
118+ timeseries .record_timeseries (ts , instrument_name = "test" )
119119
120120 database_name , table_name = get_test_db_names ()
121121 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -157,7 +157,7 @@ def test_record_timeseries_quantity_multicol(mocked_timestream):
157157 ts ["temp4" ] = [1.0 , 4.0 , 5.0 , 6.0 , 4.0 ] * u .deg_C
158158 ts ["rail5v" ] = [5.1 , 5.2 , 4.9 , 4.8 , 5.0 ] * u .volt
159159 ts ["status" ] = [0 , 1 , 1 , 1 , 2 ]
160- util .record_timeseries (ts , ts_name = timeseries_name , instrument_name = "test" )
160+ timeseries .record_timeseries (ts , ts_name = timeseries_name , instrument_name = "test" )
161161
162162 database_name , table_name = get_test_db_names ()
163163 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -224,7 +224,7 @@ def test_record_timeseries_with_nan_values(mocked_timestream):
224224 ts ["temp4" ] = [1.0 , np .nan , 5.0 , np .nan , 4.0 ] * u .deg_C
225225 ts ["rail5v" ] = [5.1 , 5.2 , np .nan , 4.8 , 5.0 ] * u .volt
226226
227- util .record_timeseries (ts , instrument_name = "test" )
227+ timeseries .record_timeseries (ts , instrument_name = "test" )
228228
229229 database_name , table_name = get_test_db_names ()
230230 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -299,7 +299,7 @@ def test_record_timeseries_with_nan_in_arrays(mocked_timestream):
299299 [[1.0 , 2.0 , np .nan , 4.0 ], [5.0 , np .nan , 7.0 , 8.0 ], [9.0 , 10.0 , 11.0 , np .nan ]]
300300 )
301301
302- util .record_timeseries (ts , instrument_name = "test" )
302+ timeseries .record_timeseries (ts , instrument_name = "test" )
303303
304304 database_name , table_name = get_test_db_names ()
305305 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -338,7 +338,7 @@ def test_record_timeseries_with_boolean_values(mocked_timestream):
338338 ts ["heater_on" ] = [True , False , True , True , False ]
339339 ts ["safety_flag" ] = [False , False , True , False , False ]
340340
341- util .record_timeseries (ts , instrument_name = "test" )
341+ timeseries .record_timeseries (ts , instrument_name = "test" )
342342
343343 database_name , table_name = get_test_db_names ()
344344 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -389,7 +389,7 @@ def test_record_timeseries_with_numpy_boolean(mocked_timestream):
389389 # Use numpy bool_ type
390390 ts ["flag" ] = np .array ([True , False , True ], dtype = np .bool_ )
391391
392- util .record_timeseries (ts , instrument_name = "test" )
392+ timeseries .record_timeseries (ts , instrument_name = "test" )
393393
394394 database_name , table_name = get_test_db_names ()
395395 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -422,7 +422,7 @@ def test_record_timeseries_with_mixed_types(mocked_timestream):
422422 ts ["mode" ] = ["nominal" , "safe" , "nominal" ]
423423 ts ["count" ] = [10 , 20 , 30 ]
424424
425- util .record_timeseries (ts , instrument_name = "test" )
425+ timeseries .record_timeseries (ts , instrument_name = "test" )
426426
427427 database_name , table_name = get_test_db_names ()
428428 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -466,7 +466,7 @@ def test_record_timeseries_all_nan_column(mocked_timestream):
466466 ts ["temp" ] = [1.0 , 2.0 , 3.0 ] * u .deg_C
467467 ts ["bad_sensor" ] = [np .nan , np .nan , np .nan ] * u .volt
468468
469- util .record_timeseries (ts , instrument_name = "test" )
469+ timeseries .record_timeseries (ts , instrument_name = "test" )
470470
471471 database_name , table_name = get_test_db_names ()
472472 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
@@ -498,7 +498,7 @@ def test_record_dimension_timestream(mocked_timestream):
498498 measure_value = 25.2
499499 measure_value_type = "DOUBLE"
500500
501- util ._record_dimension_timestream (
501+ timeseries ._record_dimension_timestream (
502502 dimensions = dimensions ,
503503 instrument_name = instrument_name ,
504504 measure_name = measure_name ,
@@ -520,7 +520,7 @@ def test_invalid_record_dimension_timestream(mocked_timestream):
520520 {"Name" : "Unit" , "Value" : "Celsius" },
521521 ]
522522
523- util ._record_dimension_timestream (
523+ timeseries ._record_dimension_timestream (
524524 dimensions = dimensions ,
525525 )
526526
@@ -536,7 +536,7 @@ def test_invalid_record_dimension_timestream(mocked_timestream):
536536def test_invalid_instrument_record_dimension_timestream (mocked_timestream ):
537537 dimensions = "invalid"
538538
539- util ._record_dimension_timestream (dimensions = dimensions )
539+ timeseries ._record_dimension_timestream (dimensions = dimensions )
540540
541541 database_name , table_name = get_test_db_names ()
542542 backend = timestreamwrite_backends [ACCOUNT_ID ]["us-east-1" ]
0 commit comments