Skip to content

Commit

Permalink
remove runtime tests, remove extra prints
Browse files Browse the repository at this point in the history
  • Loading branch information
swilly22 committed Feb 14, 2024
1 parent 57d12ac commit 213e152
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 162 deletions.
4 changes: 1 addition & 3 deletions demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ class QueryInfo(object):
This class contains the needed data about a query
"""

def __init__(self, query=None, description=None, max_run_time_ms=None, expected_result=None, reversible=True):
def __init__(self, query=None, description=None, expected_result=None, reversible=True):
"""
QueryInfo contructor
:param query: The query itself (string)
:param description: The information about what the query does (string)
:param max_run_time_ms: The max run time of the query in milliseconds (float)
:param expected_result: The expected result of the query (list of lists, where the first list
is the columns names, and the rest is the result)
"""

self.query = query
self.description = description
self.expected_result = expected_result
self.max_run_time_ms = max_run_time_ms
self.reversible = reversible

18 changes: 0 additions & 18 deletions demo/imdb/imdb_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __init__(self, actors=None, movies=None):
self.number_of_actors_query = QueryInfo(
query="""MATCH (n:actor) RETURN count(n) as actors_count""",
description='How many actors are in the graph?',
max_run_time_ms=0.2,
expected_result=[[1317]]
)

Expand All @@ -28,7 +27,6 @@ def __init__(self, actors=None, movies=None):
query="""MATCH (n:actor{name:"Nicolas Cage"})-[:act]->(m:movie)<-[:act]-(a:actor)
RETURN a.name, m.title ORDER BY a.name""",
description='Which actors played along side Nicolas Cage?',
max_run_time_ms=4,
expected_result=[['Cassi Thomson', 'Left Behind'],
['Chad Michael Murray', 'Left Behind'],
['Gary Grubbs', 'Left Behind'],
Expand All @@ -50,7 +48,6 @@ def __init__(self, actors=None, movies=None):
ORDER BY a.name, m.title
LIMIT 3""",
description='Get 3 actors who have played along side Nicolas Cage?',
max_run_time_ms=4,
expected_result=[['Cassi Thomson', 'Left Behind'],
['Chad Michael Murray', 'Left Behind'],
['Gary Grubbs', 'Left Behind']]
Expand All @@ -65,7 +62,6 @@ def __init__(self, actors=None, movies=None):
query="""MATCH (a:actor)-[:act]->(m:movie {title:"Straight Outta Compton"})
RETURN a.name""",
description='Which actors played in the movie Straight Outta Compton?',
max_run_time_ms=3.5,
expected_result=[['Aldis Hodge'],
['Corey Hawkins'],
['Neil Brown Jr.'],
Expand Down Expand Up @@ -98,7 +94,6 @@ def __init__(self, actors=None, movies=None):
WHERE a.age >= 50 AND m.votes > 10000 AND m.rating > 8.2
RETURN a, m ORDER BY a.name, m.name""",
description='Which actors who are over 50 played in blockbuster movies?',
max_run_time_ms=4.0,
expected_result=expected_result
)

Expand Down Expand Up @@ -133,7 +128,6 @@ def __init__(self, actors=None, movies=None):
RETURN a.name, m
ORDER BY m.rating""",
description='Which actors played in bad drama or comedy?',
max_run_time_ms=4,
expected_result = expected_result
)

Expand All @@ -155,7 +149,6 @@ def __init__(self, actors=None, movies=None):
RETURN DISTINCT a.name""",
description='Which actors played in Action, Drama and Comedy movies?',
reversible=False,
max_run_time_ms=1.5,
expected_result = expected_result
)

Expand All @@ -175,7 +168,6 @@ def __init__(self, actors=None, movies=None):
WHERE a.age < 35
RETURN a, m.title ORDER BY m.title""",
description='Which young actors played along side Cameron Diaz?',
max_run_time_ms=5,
expected_result=expected_result
)

Expand All @@ -201,7 +193,6 @@ def __init__(self, actors=None, movies=None):
WHERE a.age < Cameron.age
RETURN a, m.title order by a.name""",
description='Which actors played along side Cameron Diaz and are younger then her?',
max_run_time_ms=7,
expected_result=expected_result
)

Expand All @@ -214,7 +205,6 @@ def __init__(self, actors=None, movies=None):
query="""MATCH (a:actor)-[:act]->(m:movie{title:"Straight Outta Compton"})
RETURN m.title, SUM(a.age), AVG(a.age)""",
description='What is the sum and average age of the Straight Outta Compton cast?',
max_run_time_ms=4,
expected_result=[['Straight Outta Compton', 131, 32.75]]
)

Expand All @@ -227,7 +217,6 @@ def __init__(self, actors=None, movies=None):
query="""MATCH (Cameron:actor{name:"Cameron Diaz"})-[:act]->(m:movie)
RETURN Cameron.name, COUNT(m.title)""",
description='In how many movies did Cameron Diaz played?',
max_run_time_ms=1.2,
expected_result=[['Cameron Diaz', 3]]
)

Expand Down Expand Up @@ -259,7 +248,6 @@ def __init__(self, actors=None, movies=None):
ORDER BY a.age DESC
LIMIT 10""",
description='10 Oldest actors?',
max_run_time_ms=4.5,
expected_result=expected_result
)

Expand Down Expand Up @@ -287,7 +275,6 @@ def __init__(self, actors=None, movies=None):
RETURN *
ORDER BY a.age, a.name""",
description='Actors over 85 on indexed property?',
max_run_time_ms=1.5,
expected_result=expected_result
)

Expand All @@ -302,7 +289,6 @@ def __init__(self, actors=None, movies=None):
RETURN m.title, m.year
ORDER BY m.year""",
description='Multiple filters on indexed property?',
max_run_time_ms=1.5,
expected_result=[['The Evil Dead', 1981],
['Vincent', 1982]]
)
Expand All @@ -317,7 +303,6 @@ def __init__(self, actors=None, movies=None):
RETURN m.title
ORDER BY m.title""",
description='Movies starting with "American"?',
max_run_time_ms=4,
expected_result=[['American Honey'],
['American Pastoral'],
['American Sniper']]
Expand All @@ -337,7 +322,6 @@ def __init__(self, actors=None, movies=None):
LIMIT 10""",
description='List 10 movies released on the same year as "Hunt for the Wilderpeople" that got higher rating than it',
reversible=False,
max_run_time_ms=0.8,
expected_result=[["Hacksaw Ridge", 8.8],
["Moonlight", 8.7],
["La La Land", 8.6],
Expand All @@ -360,7 +344,6 @@ def __init__(self, actors=None, movies=None):
ORDER BY node.name""",
description='All actors named Tim',
reversible=False,
max_run_time_ms=4,
expected_result=[['Tim Roth'],
['Tim Reid'],
['Tim McGraw'],
Expand All @@ -381,7 +364,6 @@ def __init__(self, actors=None, movies=None):

description='All actors in The Grand Budapest Hotel and their other movies',
reversible=False,
max_run_time_ms=4,
expected_result=[['Adrien Brody', None],
['Bill Murray', 'The Jungle Book'],
['F. Murray Abraham', None],
Expand Down
Loading

0 comments on commit 213e152

Please sign in to comment.