[Enh]: Provide `testing` module to enable downstream libraries testing
We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?
- This is a long shot, and I am not sure which (if any) and how other libraries do it.
- For sure I could see adoption in scikit-lego
Please describe the purpose of the new feature or describe the problem to solve.
Provide a standard set of values and functionalities to generate tables for each backend we support
Suggest a solution if possible.
- Have this as a separate library, let's say `narwhals-testing"
- Have this in an internal module, which we can use for our testing purpose as well
If you have tried alternatives, please describe them below.
Manually create tables in downstream library :)
Additional information that may help us understand your needs.
No response
Agree! I think @machow also wanted some testing functionality exposed for Shiny
Adding some tracking here for what in my opinion means to close this PR:
- [ ]
nw.testingmodule- [ ]
nw.testing.assert_series_equal- WIP in #2983 - [ ]
nw.testing.assert_frame_equal- blocked by #2983
- [ ]
- [ ]
nw.constructorsmodule to provide fixture(s) to use in test suite of downstream libraries- Discord dicussion
- My naive attempt: testing-fixtures branch
- A more sophisticated approach by @EdAbati: draft-new-constructor
- A more sophisticated approach by @EdAbati: draft-new-constructor
(There is a fine line between 'more sophisticated' and 'overly complicated' 😅 I hope to finish the draft soon)
Originally posted by @elephaint in #2804
[!NOTE] Edited by @dangotbanned
Is this feature is needed to adopt Narwhals in an open source project?
At first
hierarchicalforecast, in the future also our other open-source libraries in the Nixtla ecosystemDescribe the problem to solve
pandas.testing.assert_frame_equalandpolars.testing.assert_frame_equalare really convenient when unit testing functionality.Ideally, Narwhals has it too, so that we can abstract away from the dataframe provided and run the unit test on any desired dataframe engine.
Suggest a solution
Include wrappers for this testing functionality, or include native Narwhals testing functionality, e.g.
nw.testing.asserts.assert_frame_equal
https://github.com/narwhals-dev/narwhals/issues/739#issuecomment-3225435754
nw.constructorsmodule to provide fixture(s) to use in test suite of downstream libraries
@FBruzzesi did you mean nw.testing.constructors?
Since the other stuff is in nw.testing.asserts 😄
Either way, I'm keen to see a child issue for that idea and discuss what's going on in yours and @EdAbati's and branches