Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
xzdandy committed Nov 13, 2023
1 parent 7905d69 commit ee7488d
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/unit_tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from evadb.expression.comparison_expression import ComparisonExpression
from evadb.expression.constant_value_expression import ConstantValueExpression
from evadb.expression.function_expression import FunctionExpression
from evadb.expression.tuple_value_expression import TupleValueExpression
from evadb.expression.logical_expression import LogicalExpression
from evadb.expression.tuple_value_expression import TupleValueExpression
from evadb.parser.alias import Alias
from evadb.parser.create_function_statement import CreateFunctionStatement
from evadb.parser.create_index_statement import CreateIndexStatement
Expand Down Expand Up @@ -547,9 +547,13 @@ def _verify_select_statement(evadb_statement_list):
# target list
self.assertIsNotNone(select_stmt.target_list)
self.assertEqual(len(select_stmt.target_list), 2)
self.assertEqual(select_stmt.target_list[0].etype, ExpressionType.TUPLE_VALUE)
self.assertEqual(
select_stmt.target_list[0].etype, ExpressionType.TUPLE_VALUE
)
self.assertEqual(select_stmt.target_list[0].name, "CLASS")
self.assertEqual(select_stmt.target_list[1].etype, ExpressionType.TUPLE_VALUE)
self.assertEqual(
select_stmt.target_list[1].etype, ExpressionType.TUPLE_VALUE
)
self.assertEqual(select_stmt.target_list[1].name, "REDNESS")

# from table
Expand All @@ -566,7 +570,7 @@ def _verify_select_statement(evadb_statement_list):
right = select_stmt.where_clause.children[1]
self.assertEqual(left.etype, ExpressionType.COMPARE_EQUAL)
self.assertEqual(right.etype, ExpressionType.COMPARE_LESSER)

self.assertEqual(len(left.children), 2)
self.assertEqual(left.children[0].etype, ExpressionType.TUPLE_VALUE)
self.assertEqual(left.children[0].name, "CLASS")
Expand All @@ -580,20 +584,25 @@ def _verify_select_statement(evadb_statement_list):
self.assertEqual(right.children[1].value, 400)

parser = Parser()
select_query = "SELECT CLASS, REDNESS FROM TAIPAI WHERE CLASS = 'VAN' AND REDNESS < 400;"
select_query = (
"SELECT CLASS, REDNESS FROM TAIPAI WHERE CLASS = 'VAN' AND REDNESS < 400;"
)
_verify_select_statement(parser.parse(select_query))

# Case insensitive test
select_query = "select CLASS, REDNESS from TAIPAI where CLASS = 'VAN' and REDNESS < 400;"
select_query = (
"select CLASS, REDNESS from TAIPAI where CLASS = 'VAN' and REDNESS < 400;"
)
_verify_select_statement(parser.parse(select_query))

# Unsupported logical operator
select_query = "SELECT CLASS, REDNESS FROM TAIPAI WHERE CLASS = 'VAN' XOR REDNESS < 400;"
select_query = (
"SELECT CLASS, REDNESS FROM TAIPAI WHERE CLASS = 'VAN' XOR REDNESS < 400;"
)
with self.assertRaises(NotImplementedError) as cm:
parser.parse(select_query)
self.assertEqual(str(cm.exception), "Unsupported logical operator: XOR")


def test_select_statement_groupby_class(self):
"""Testing sample frequency"""

Expand Down

0 comments on commit ee7488d

Please sign in to comment.