api/edited: make sure inferred_freq works over the federation
3 files changed, 48 insertions(+), 0 deletions(-)

M conftest.py
M test/test_api.py
M tshistory_supervision/api.py
M conftest.py +2 -0
@@ 98,6 98,7 @@ def client(engine):
 
 def _initschema(engine):
     supervision_schema('tsh').create(engine)
+    supervision_schema('remote').create(engine)
 
 
 tsx = make_tsx(

          
@@ 106,5 107,6 @@ tsx = make_tsx(
     timeseries,
     http.supervision_httpapi,
     http.supervision_httpclient,
+    sources={'remote': (DBURI, 'remote')},
     with_http_bridge=with_http_bridge
 )

          
M test/test_api.py +45 -0
@@ 332,6 332,51 @@ 2024-01-06    6.0
     assert len(markers) == 1
 
 
+def test_remote_infer_freq(tsx, engine):
+    ts = pd.Series(
+        [1, 2, 3, 4, 6],
+        index=[
+            pd.Timestamp('2024-01-01'),
+            pd.Timestamp('2024-01-02'),
+            pd.Timestamp('2024-01-03'),
+            pd.Timestamp('2024-01-04'),
+            pd.Timestamp('2024-01-06'),
+        ]
+    )
+
+    from tshistory.tsio import timeseries
+    rtsh = timeseries('remote')
+    rtsh.update(
+        engine,
+        ts,
+        'remote_series_with_holes',
+        author='Babar'
+    )
+
+    ts, markers = tsx.edited('remote_series_with_holes')
+    assert len(ts) == 5
+
+    ts, markers = tsx.edited('remote_series_with_holes', inferred_freq=True)
+
+    assert_df("""
+2024-01-01    1.0
+2024-01-02    2.0
+2024-01-03    3.0
+2024-01-04    4.0
+2024-01-05    NaN
+2024-01-06    6.0
+""", ts)
+
+    assert_df("""
+2024-01-01    False
+2024-01-02    False
+2024-01-03    False
+2024-01-04    False
+2024-01-05    False
+2024-01-06    False
+""", markers)
+
+
 def test_infer_freq_tz(tsx):
     """Since we build a pseudo index based
     both on request bounds and the series index

          
M tshistory_supervision/api.py +1 -0
@@ 38,6 38,7 @@ def edited(self, name: str,
         revision_date,
         from_value_date,
         to_value_date,
+        inferred_freq=inferred_freq,
         _keep_nans=_keep_nans
     )