Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert_frame_not_equal does not raise when input types are different #18401

Closed
2 tasks done
henryharbeck opened this issue Aug 27, 2024 · 6 comments · Fixed by #18402
Closed
2 tasks done

assert_frame_not_equal does not raise when input types are different #18401

henryharbeck opened this issue Aug 27, 2024 · 6 comments · Fixed by #18402
Labels
bug Something isn't working python Related to Python Polars

Comments

@henryharbeck
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

from polars.testing import assert_frame_not_equal

df1 = pl.DataFrame({"a": [1, 2, 3]})
df2 = pl.DataFrame({"a": [1, 5, 3]})

assert_frame_not_equal(df1, df2.lazy()) # no AssertionError raised

Log output

No response

Issue description

assert_frame_not_equal should raise when the types are not the same

Expected behavior

It should raise the same way this does

from polars.testing import assert_frame_equal

df1 = pl.DataFrame({"a": [1, 2, 3]})

assert_frame_equal(df1, df1.lazy())
# AssertionError: inputs are different (unexpected input types)
# [left]:  DataFrame
# [right]: LazyFrame

Installed versions

main branch

@henryharbeck henryharbeck added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Aug 27, 2024
@alexander-beedie
Copy link
Collaborator

I see why it's happening... of course technically the frames aren't equal as they are of different types, heh. But that's not what the function is testing, so I agree that it should raise here ;)

@alexander-beedie alexander-beedie removed the needs triage Awaiting prioritization by a maintainer label Aug 27, 2024
@henryharbeck
Copy link
Contributor Author

technically the frames aren't equal as they are of different types, heh

🤣 you are not wrong

Fix incoming!

@alexander-beedie
Copy link
Collaborator

Fix incoming!

Ahh, already committed one 😅
Spotted we had the same issue with assert_series_equal too.

@henryharbeck
Copy link
Contributor Author

Very fast! Appreciate the quick turnaround!

@mcrumiller
Copy link
Contributor

Spotted we had the same issue with assert_series_equal too.

Was this possible to hit? There is no lazy Series.

@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Aug 28, 2024

Was this possible to hit? There is no lazy Series.

Yes, as you can hit it on any mismatched type...
For example, this will currently not raise (but should):

from polars.testing import assert_series_not_equal
import polars as pl

s1 = pl.Series([1,2,3])
s2 = "I am a potato"

# does not (currently) raise about the mismatched/invalid input
assert_series_not_equal(s1, s2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
3 participants