Skip to content

Commit 5e6f004

Browse files
authored
Fix negation with AND (#39)
There was a problem with `not cubic` and `not tree`.
1 parent c40c7e8 commit 5e6f004

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/graphreveal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from platformdirs import user_data_dir
55

6-
__version__ = "0.2.1"
6+
__version__ = "0.2.2"
77

88
DATABASE_PATH = os.path.join(
99
user_data_dir(appname="graphreveal", appauthor="graphreveal"), "graphs.db"

src/graphreveal/translator/QueryTranslator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def visitSimpleExpr(self, ctx: QueryParser.SimpleExprContext):
3232
return self.visitChildren(ctx)
3333

3434
def visitNotExpr(self, ctx: QueryParser.NotExprContext):
35-
return "NOT " + self.visitChildren(ctx)
35+
return "NOT (" + self.visitChildren(ctx) + ")"
3636

3737
def visitNumEntityProperty(self, ctx: QueryParser.NumEntityPropertyContext):
3838
num = ctx.INTEGER().getText()

tests/test_query_results.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
("7 vertices, eulerian", 37),
2020
("5 vertices, connected, planar", 20),
2121
("5 vertices, tree", 3),
22+
("3 vertices, not tree", 3),
2223
("5 vertices, 2 components", 8),
2324
("3 edges, no isolated vertices", 5),
2425
("1 vertex, hamiltonian", 1),

0 commit comments

Comments
 (0)