sktime / skbase

Base classes for creating scikit-learn-like parametric objects, and tools for working with them.
BSD 3-Clause "New" or "Revised" License
16 stars 11 forks source link

[ENH] add tests for html repr in `BaseObject` descendants #357

Open fkiraly opened 2 weeks ago

fkiraly commented 2 weeks ago

We should add a test for html repr of all BaseObject descendants, in TestAllObjects.

This was apparently not tested, see https://github.com/sktime/sktime/pull/7043

fkiraly commented 2 weeks ago

FYI @mateuszkasprowicz - suggestions on how best to test this? Just that the html repr does not lead to error.

mateuszkasprowicz commented 1 week ago

I'm thinking something like snapshot testing for this. For example:

def test_base_object_html_snapshot(base_object):
    f = StringIO()
    with redirect_stdout(f):
        display(base_object)
    html_output = f.getvalue()
    expected_output = "correct html"
    # some assertions
fkiraly commented 1 week ago

Hm, that would work, I would add it to the general test suite in addition though - that is: