From 4e0b322ce83b24c4b4a5af5d3e4f7f85ec47ec24 Mon Sep 17 00:00:00 2001 From: Vincent Chan Date: Wed, 18 Dec 2024 14:08:52 -0800 Subject: [PATCH] Remove automatic element to string equality check --- hyperscript/element.py | 4 +--- tests/test_element.py | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hyperscript/element.py b/hyperscript/element.py index de0655b..b78619c 100644 --- a/hyperscript/element.py +++ b/hyperscript/element.py @@ -131,6 +131,4 @@ def _parts(self, remove_empty: bool = False) -> list[str]: def __eq__(self, other: Any) -> bool: if isinstance(other, Element): return str(self) == str(other) - if isinstance(other, str): - return str(self) == other - return False + return super().__eq__(other) diff --git a/tests/test_element.py b/tests/test_element.py index 9a51f1e..2a46f7b 100644 --- a/tests/test_element.py +++ b/tests/test_element.py @@ -84,8 +84,6 @@ def test_equality(self) -> None: self.assertEqual(h("div", h("p", "Foo")), h("div", h("p", "Foo"))) - self.assertEqual(h("div", h("p", "Foo")), "

Foo

") - self.assertNotEqual(h("div"), h("p")) self.assertNotEqual(h("div", h("p", "Foo")), h("div", h("p", "Bar")))