Skip to content

Commit

Permalink
Add test query on python dict
Browse files Browse the repository at this point in the history
  • Loading branch information
auxten committed Jul 1, 2024
1 parent 25faa6b commit 2d3418d
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions tests/test_query_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,33 @@ def test_query_arrow2(self):
# )
# self.assertEqual(str(ret), EXPECTED)

# def test_query_dict(self):
# data = {
# "a": [1, 2, 3, 4, 5, 6],
# "b": ["tom", "jerry", "auxten", "tom", "jerry", "auxten"],
# }
def test_query_dict(self):
data = {
"a": [1, 2, 3, 4, 5, 6],
"b": ["tom", "jerry", "auxten", "tom", "jerry", "auxten"],
}

# ret = chdb.query("SELECT b, sum(a) FROM Python(data) GROUP BY b ORDER BY b")
# self.assertEqual(str(ret), EXPECTED)
ret = chdb.query(
"SELECT b, sum(a) FROM Python(data) GROUP BY b ORDER BY b", "debug"
)
self.assertEqual(str(ret), EXPECTED)

def test_query_dict_int(self):
data = {
"a": [1, 2, 3, 4, 5, 6],
"b": [1, 2, 3, 1, 2, 3],
}

ret = chdb.query(
"SELECT b, sum(a) FROM Python(data) GROUP BY b ORDER BY b", "debug"
)
self.assertEqual(
str(ret),
"""1,5
2,7
3,9
""",
)


if __name__ == "__main__":
Expand Down

0 comments on commit 2d3418d

Please sign in to comment.