MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_datetime_naive_sub_const

Function test_datetime_naive_sub_const

python/pathway/tests/test_operators.py:998–1012  ·  view source on GitHub ↗
(const: Any)

Source from the content-addressed store, hash-verified

996 ],
997)
998def test_datetime_naive_sub_const(const: Any) -> None:
999 datetimes = [
1000 "2023-05-15 01:59:59.999999999",
1001 "2023-05-15 11:59:59.999999999",
1002 ]
1003 fmt = "%Y-%m-%d %H:%M:%S.%f"
1004 df = pd.DataFrame({"a": datetimes})
1005 table = table_from_pandas(df)
1006 table_with_dt = table.select(a=table.a.dt.strptime(fmt))
1007 table_pw = table_with_dt.select(a=table_with_dt.a - const)
1008
1009 df_new = pd.DataFrame({"a": pd.to_datetime(datetimes, format=fmt) - const})
1010 table_pd = table_from_pandas(df_new)
1011
1012 assert_table_equality(table_pw, table_pd)
1013
1014
1015@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

table_from_pandasFunction · 0.90
strptimeMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected