From e811a84ed4559be22ae335447735ec57827e8c7e Mon Sep 17 00:00:00 2001 From: jonatan <32123499+jonaengs@users.noreply.github.com> Date: Mon, 3 Apr 2023 00:40:52 +0200 Subject: [PATCH] Use strict equality in generated JS (#750) --- pynecone/var.py | 4 ++-- tests/test_var.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pynecone/var.py b/pynecone/var.py index c31ca1b9b..52db1bb16 100644 --- a/pynecone/var.py +++ b/pynecone/var.py @@ -373,7 +373,7 @@ class Var(ABC): Returns: A var representing the equality comparison. """ - return self.compare("==", other) + return self.compare("===", other) def __ne__(self, other: Var) -> Var: """Perform an inequality comparison. @@ -384,7 +384,7 @@ class Var(ABC): Returns: A var representing the inequality comparison. """ - return self.compare("!=", other) + return self.compare("!==", other) def __gt__(self, other: Var) -> Var: """Perform a greater than comparison. diff --git a/tests/test_var.py b/tests/test_var.py index a81b2b30a..c2aba06e5 100644 --- a/tests/test_var.py +++ b/tests/test_var.py @@ -167,8 +167,8 @@ def test_basic_operations(TestObj): Args: TestObj: The test object. """ - assert str(v(1) == v(2)) == "{(1 == 2)}" - assert str(v(1) != v(2)) == "{(1 != 2)}" + assert str(v(1) == v(2)) == "{(1 === 2)}" + assert str(v(1) != v(2)) == "{(1 !== 2)}" assert str(v(1) < v(2)) == "{(1 < 2)}" assert str(v(1) <= v(2)) == "{(1 <= 2)}" assert str(v(1) > v(2)) == "{(1 > 2)}"