Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ dependencies = [
# NOTE: 1.7.0 is latest version of vl-convert which ships with Vega 5. In webapp we can't update to Vega 6 due to ESM-only issues
# so we keep vl-convert version pinned as well
"vl-convert-python==1.7.0",
"deepnote-vegafusion>=2.1.0,<3",
"deepnote-vegafusion>=2.1.1,<3",
"matplotlib-inline>=0.1.7,<0.2.0; python_version <= '3.10'", # 0.2.0 is not compatible with matplotlib 3.6.3 on Python <=3.10
"matplotlib-inline>=0.2.1,<0.3.0; python_version >= '3.11'",

Expand Down
33 changes: 33 additions & 0 deletions tests/unit/test_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,39 @@ def test_works_with_polars_uuid_object_column(self):
spec = {"mark": "bar", "encoding": {"x": {"field": "id"}}}
self._assert_chart_is_json_serializable(df, spec)

# Regression test: naive timestamp strings only parsed with 0 or 3 fractional digits.
@parameterized.expand(
[
("no_fraction", "2024-01-01 10:00:00", "2024-01-01T10:00:00.000"),
("tenths", "2024-01-01 10:00:00.1", "2024-01-01T10:00:00.100"),
("milliseconds", "2024-01-01 10:00:00.123", "2024-01-01T10:00:00.123"),
("microseconds", "2024-01-01 10:00:00.123456", "2024-01-01T10:00:00.123"),
(
"nanoseconds",
"2024-01-01 10:00:00.123456789",
"2024-01-01T10:00:00.123",
),
]
)
def test_timezone_naive_string_timestamps(self, _name, raw_timestamp, expected):
df = pd.DataFrame({"ts": [raw_timestamp], "value": [1]})
spec = {
"mark": "line",
"encoding": {
"x": {"field": "ts", "type": "temporal"},
"y": {"field": "value", "type": "quantitative"},
},
}

chart = DeepnoteChart(df, spec_dict=spec)

charted_rows = [
dataset["values"]
for dataset in chart.compiled_vega_spec_dict["data"]
if dataset.get("values") and "ts" in dataset["values"][0]
]
self.assertEqual(charted_rows, [[{"ts": expected, "value": 1}]])


class TestDeepnoteSanitizeDataframe(unittest.TestCase):
def test_small_dataframe_remains_ordered_the_same(self):
Expand Down
Loading