I also ran into this issue.
In your case you could solve it by testing as:
div_a.__dict__ == div_b.__dict__ # False
But; that still doesn’t solve it in all (including my own) case as this also happens once you have nested components:
div2_a = html.Div([html.Summary('a')])
div2_b = html.Div([html.Summary('b')])
div2_a.__dict__ == div2_b.__dict__ # True
div2_a == div2_b # True!
div2_a.children.children == div2_b.children.children # finally False!
My guess is that the
__eq__ implementation for the components only checks if they are instances of the same class and ignores checking on any further properties, hence what you observed and that nested children are also never equated, but haven’t actually found it in the source yet.
I’m currently trying something like this and it’s working ok but feels kinda janky…
maxDiff = None
def assert_html_equal(self, html1, html2):
print('html1:', html1.__dict__, ', html2:', html2.__dict__, sep='')
for h1, h2 in zip(html1.children, html2.children):