MCPcopy Index your code
hub / github.com/dask/dask / test_datetimes

Function test_datetimes

dask/dataframe/io/tests/test_sql.py:348–367  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

346
347
348def test_datetimes():
349 import datetime
350
351 now = datetime.datetime.now()
352 d = datetime.timedelta(seconds=1)
353 df = pd.DataFrame(
354 {"a": list("ghjkl"), "b": [now + i * d for i in range(2, -3, -1)]}
355 )
356 with tmpfile() as f:
357 uri = f"sqlite:///{f}"
358 df.to_sql("test", uri, index=False, if_exists="replace")
359 data = read_sql_table("test", uri, npartitions=2, index_col="b")
360 assert data.index.dtype.kind == "M"
361 assert data.divisions[0] == df.b.min()
362 df2 = df.set_index("b")
363 assert_eq(
364 data.map_partitions(lambda x: x.sort_index()),
365 df2.sort_index(),
366 check_dtype=False,
367 )
368
369
370def test_extra_connection_engine_keywords(caplog, db):

Callers

nothing calls this directly

Calls 7

set_indexMethod · 0.95
tmpfileFunction · 0.90
read_sql_tableFunction · 0.90
assert_eqFunction · 0.90
to_sqlMethod · 0.80
minMethod · 0.45
map_partitionsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…