Add tests for literal `{}` used with array, map, and tuple.
@@ -723,6 +723,37 @@ class TestExpressions(tb.QueryTestCase):
[[1, 2, 3, 4]],
])
+ @unittest.expectedFailure
+ async def test_edgeql_expr_array_06(self):
+ await self.assert_query_result('''
+ SELECT [1, <int>{}];
+ ''', [
+ [],
+ ])
+
+ @unittest.expectedFailure
+ async def test_edgeql_expr_array_07(self):
+ await self.assert_query_result('''
+ WITH
+ A := {1, 2},
+ B := <int>{}
+ SELECT [A, B];
+ ''', [
+ [],
+ ])
+
+ async def test_edgeql_expr_array_08(self):
+ await self.assert_query_result('''
+ WITH
+ MODULE schema,
+ A := {'a', 'b'},
+ # B is an empty set
+ B := (SELECT Type FILTER Type.name = 'n/a').name
+ SELECT [A, B];
+ ''', [
+ [],
+ ])
+
async def test_edgeql_expr_map_01(self):
await self.assert_query_result(r"""
SELECT ['fo' + 'o' -> 42];
@@ -880,6 +911,37 @@ class TestExpressions(tb.QueryTestCase):
[1],
])
+ @unittest.expectedFailure
+ async def test_edgeql_expr_map_07(self):
+ await self.assert_query_result('''
+ SELECT ['a' -> <int>{}];
+ ''', [
+ [],
+ ])
+
+ @unittest.expectedFailure
+ async def test_edgeql_expr_map_08(self):
+ await self.assert_query_result('''
+ WITH
+ A := {'a', 'b'},
+ B := <int>{}
+ SELECT [A -> B];
+ ''', [
+ [],
+ ])
+
+ async def test_edgeql_expr_map_09(self):
+ await self.assert_query_result('''
+ WITH
+ MODULE schema,
+ A := {'a', 'b'},
+ # B is an empty set
+ B := (SELECT Type FILTER Type.name = 'n/a').name
+ SELECT [A -> B];
+ ''', [
+ [],
+ ])
+
async def test_edgeql_expr_coalesce_01(self):
await self.assert_query_result(r"""
SELECT {} ?? 4 ?? 5;
@@ -1078,6 +1140,37 @@ class TestExpressions(tb.QueryTestCase):
[[1, ['a', 'b', [0.1, 0.2]], 2, 3]],
])
+ @unittest.expectedFailure
+ async def test_edgeql_expr_tuple_14(self):
+ await self.assert_query_result('''
+ SELECT (1, <int>{});
+ ''', [
+ [],
+ ])
+
+ @unittest.expectedFailure
+ async def test_edgeql_expr_tuple_15(self):
+ await self.assert_query_result('''
+ WITH
+ A := {1, 2},
+ B := <int>{}
+ SELECT (A, B);
+ ''', [
+ [],
+ ])
+
+ async def test_edgeql_expr_tuple_15(self):
+ await self.assert_query_result('''
+ WITH
+ MODULE schema,
+ A := {'a', 'b'},
+ # B is an empty set
+ B := (SELECT Type FILTER Type.name = 'n/a').name
+ SELECT (A, B);
+ ''', [
+ [],
+ ])
+
async def test_edgeql_expr_tuple_indirection_01(self):
await self.assert_query_result(r"""
SELECT ('foo', 42).0;
