From a5a90d0ef798b4c95ee7b5845a993642972ed1b3 Mon Sep 17 00:00:00 2001 From: imilinovic Date: Sun, 18 Feb 2024 21:16:09 +0100 Subject: [PATCH] add =~ operator --- gqlalchemy/query_builders/declarative_base.py | 1 + tests/query_builders/test_query_builders.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gqlalchemy/query_builders/declarative_base.py b/gqlalchemy/query_builders/declarative_base.py index e97094a1..11531fac 100644 --- a/gqlalchemy/query_builders/declarative_base.py +++ b/gqlalchemy/query_builders/declarative_base.py @@ -92,6 +92,7 @@ class Operator(Enum): LEQ_THAN = "<=" NOT_EQUAL = "!=" INCREMENT = "+=" + SIMILAR = "=~" class Order(Enum): diff --git a/tests/query_builders/test_query_builders.py b/tests/query_builders/test_query_builders.py index 7e4ae429..c4f9f4c6 100644 --- a/tests/query_builders/test_query_builders.py +++ b/tests/query_builders/test_query_builders.py @@ -306,7 +306,7 @@ def test_multiple_merges(self, vendor): mock.assert_called_with(expected_query) - @pytest.mark.parametrize("operator", ["=", "<>", "<", "!=", ">", "<=", ">="]) + @pytest.mark.parametrize("operator", ["=", "<>", "<", "!=", ">", "<=", ">=", "=~"]) def test_where_without_operator_enum(self, vendor, operator): query_builder = ( vendor[1] @@ -318,7 +318,6 @@ def test_where_without_operator_enum(self, vendor, operator): .return_() ) expected_query = f" MATCH (n:L1)-[:TO]->(m:L2) WHERE n.name {operator} 'best_name' RETURN * " - with patch.object(vendor[0], "execute_and_fetch", return_value=None) as mock: query_builder.execute()