Skip to content

Conversation

@FBruzzesi
Copy link
Member

@FBruzzesi FBruzzesi commented Oct 18, 2025

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

50%+ of the changes are docstrings and tests

@FBruzzesi FBruzzesi added the enhancement New feature or request label Oct 18, 2025
Comment on lines +231 to +233
# TODO(FBruzzesi): Do we even this? What should we check?
# The best way could be to migrate away from `assert_equal_data` in the test suite
def test_values_mismatch(constructor: Constructor) -> None: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking for help in finding edge cases here πŸ˜‡

@FBruzzesi FBruzzesi marked this pull request as ready for review October 18, 2025 10:53
Comment on lines 25 to 36
DataFramesDetail: TypeAlias = (
Literal[
"columns are not in the same order",
"dtypes do not match",
"height (row count) mismatch",
"implementation mismatch",
]
| str
# NOTE: `| str` makes the literals above redundant, but they still show
# up when typing as autocompletion.
# The reason to have `str` is due to the fact that other details are dynamic
# and depend upon which columns lead to the assertion error.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangotbanned do you see a better way of doing this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first thought would be to keep the *Detail aliases for static portion of the message.

I haven't looked through to see how the dynamic stuff works yet - particularly where it is sourced and where it gets inserted - but if you had these things separated into 2 parameters then it might work?

E.g. if you added another parameter with not_thing: str = "", that could just get skipped when empty?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangotbanned
Copy link
Member

@FBruzzesi you might be able to adapt this test from (vega/altair#3922) into something for timezones?

At least the source data may give you something to compare πŸ™‚

import polars as pl

start = pl.datetime(2023, 11, 5, time_zone="US/Mountain")
pl.select(
    datetime=pl.datetime_range(start, start.dt.offset_by("3h"), "1h"),
    value=pl.int_range(10, 50, 10),
)
shape: (4, 2)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ datetime                  ┆ value β”‚
β”‚ ---                       ┆ ---   β”‚
β”‚ datetime[ΞΌs, US/Mountain] ┆ i64   β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ═══════║
β”‚ 2023-11-05 00:00:00 MDT   ┆ 10    β”‚
β”‚ 2023-11-05 01:00:00 MDT   ┆ 20    β”‚
β”‚ 2023-11-05 01:00:00 MST   ┆ 30    β”‚
β”‚ 2023-11-05 02:00:00 MST   ┆ 40    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

@FBruzzesi
Copy link
Member Author

FBruzzesi commented Nov 25, 2025

Hey @dangotbanned πŸ‘‹πŸΌ I am missing some context for the #3220 (comment)

What would you like to see achieved? If it's dataframe with one or more datetime with timezones colujmns, then those checks are delegated to the series equality πŸ‘€ (via assert_series_equal), which is then dispatched with the usual narwhals mechanism

is_not_equal_mask = left != right
if is_not_equal_mask.any(): ...

@dangotbanned
Copy link
Member

Hey @dangotbanned πŸ‘‹πŸΌ I am missing some context for the #3220 (comment)

What would you like to see achieved?

Oof my bad, I was supposed to have replied on the (#3220 (comment)) thread πŸ˜…

Looking for help in finding edge cases here πŸ˜‡

Maybe I'm naive πŸ˜‰, but I hadn't come across that timezone before - so I thought it might help?

@FBruzzesi
Copy link
Member Author

Warning

This proposal might end up be a bit overwhelming in one go

The best way to test this implementation would be to start rolling it out as proposed in #3221 - I can branch out from here and start doing that, maybe on a specific subset of tests (say tests/frame/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support assert_frame_equal

3 participants