Skip to content

Commit

Permalink
Updated error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed May 22, 2024
1 parent 61862f5 commit 473d322
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
4 changes: 2 additions & 2 deletions edb/schema/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ def _populate_concrete_constraint_attrs(
)
op_name = str(set_of_op.func_shortname)
raise errors.UnsupportedFeatureError(
f"cannot use aggregate {label} '{op_name}' "
f"in a non-aggregating constraint",
f"cannot use SET OF {label} '{op_name}' "
f"in a singleton constraint",
span=set_of_op.span
)

Expand Down
2 changes: 1 addition & 1 deletion edb/schema/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def compile_expr_field(
)
op_name = str(set_of_op.func_shortname)
raise errors.SchemaDefinitionError(
f"cannot use aggregate {label} '{op_name}' "
f"cannot use SET OF {label} '{op_name}' "
f"in an index expression",
span=set_of_op.span
)
Expand Down
28 changes: 14 additions & 14 deletions tests/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,8 +1401,8 @@ async def test_constraints_ddl_08(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::EXISTS' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::EXISTS' "
"in a singleton constraint",
):
await self.con.execute("""
ALTER TYPE ObjCnstr2 {
Expand All @@ -1412,8 +1412,8 @@ async def test_constraints_ddl_08(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::EXISTS' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::EXISTS' "
"in a singleton constraint",
):
await self.con.execute("""
ALTER TYPE ObjCnstr2 {
Expand Down Expand Up @@ -2134,8 +2134,8 @@ async def test_constraints_singleton_set_ops_01(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::IN' "
"in a non-aggregating constraint"
"cannot use SET OF operator 'std::IN' "
"in a singleton constraint"
):
await self.con.execute(
"""
Expand All @@ -2162,8 +2162,8 @@ async def test_constraints_singleton_set_ops_02(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::NOT IN' "
"in a non-aggregating constraint"
"cannot use SET OF operator 'std::NOT IN' "
"in a singleton constraint"
):
await self.con.execute(
"""
Expand All @@ -2190,8 +2190,8 @@ async def test_constraints_singleton_set_ops_03(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::EXISTS' "
"in a non-aggregating constraint"
"cannot use SET OF operator 'std::EXISTS' "
"in a singleton constraint"
):
await self.con.execute(
"""
Expand All @@ -2218,8 +2218,8 @@ async def test_constraints_singleton_set_ops_04(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
r"cannot use aggregate operator 'std::\?\?' "
r"in a non-aggregating constraint"
r"cannot use SET OF operator 'std::\?\?' "
r"in a singleton constraint"
):
await self.con.execute(
"""
Expand Down Expand Up @@ -2248,8 +2248,8 @@ async def test_constraints_singleton_set_ops_05(self):

async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::IF' "
"in a non-aggregating constraint"
"cannot use SET OF operator 'std::IF' "
"in a singleton constraint"
):
await self.con.execute(
"""
Expand Down
16 changes: 8 additions & 8 deletions tests/test_edgeql_ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10852,8 +10852,8 @@ async def test_edgeql_ddl_constraint_26(self):
async def test_edgeql_ddl_constraint_27(self):
async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint"):
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint"):
await self.con.execute(r"""
CREATE TYPE default::ConstraintNonSingletonTest {
CREATE PROPERTY has_bad_constraint: std::str {
Expand All @@ -10867,8 +10867,8 @@ async def test_edgeql_ddl_constraint_27(self):
async def test_edgeql_ddl_constraint_28(self):
async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint"):
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint"):
await self.con.execute(r"""
CREATE TYPE default::ConstraintNonSingletonTest {
CREATE PROPERTY has_bad_constraint: std::str {
Expand All @@ -10882,8 +10882,8 @@ async def test_edgeql_ddl_constraint_28(self):
async def test_edgeql_ddl_constraint_29(self):
async with self.assertRaisesRegexTx(
edgedb.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint"):
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint"):
await self.con.execute(r"""
CREATE TYPE default::ConstraintNonSingletonTest {
CREATE PROPERTY has_bad_constraint: std::str;
Expand Down Expand Up @@ -13218,7 +13218,7 @@ async def test_edgeql_ddl_index_07(self):
async def test_edgeql_ddl_index_08(self):
async with self.assertRaisesRegexTx(
edgedb.SchemaDefinitionError,
"cannot use aggregate operator 'std::DISTINCT' "
"cannot use SET OF operator 'std::DISTINCT' "
"in an index expression"):
await self.con.execute(r"""
CREATE TYPE default::IndexNonSingletonTest {
Expand All @@ -13230,7 +13230,7 @@ async def test_edgeql_ddl_index_08(self):
async def test_edgeql_ddl_index_09(self):
async with self.assertRaisesRegexTx(
edgedb.SchemaDefinitionError,
"cannot use aggregate function 'std::count' "
"cannot use SET OF function 'std::count' "
"in an index expression"):
await self.con.execute(r"""
CREATE TYPE default::IndexNonSingletonTest {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async def test_index_05(self):

async with self.assertRaisesRegexTx(
edgedb.SchemaDefinitionError,
"cannot use aggregate operator 'std::EXISTS' "
"cannot use SET OF operator 'std::EXISTS' "
"in an index expression",
):
await self.con.execute(
Expand All @@ -186,7 +186,7 @@ async def test_index_05(self):

async with self.assertRaisesRegexTx(
edgedb.SchemaDefinitionError,
"cannot use aggregate function 'std::count' "
"cannot use SET OF function 'std::count' "
"in an index expression",
):
await self.con.execute(
Expand Down
52 changes: 26 additions & 26 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2577,8 +2577,8 @@ def test_schema_enum_04(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_01(self):
"""
Expand All @@ -2593,8 +2593,8 @@ def test_schema_constraint_non_singleton_01(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_02(self):
"""
Expand All @@ -2609,8 +2609,8 @@ def test_schema_constraint_non_singleton_02(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_03(self):
"""
Expand Down Expand Up @@ -2663,8 +2663,8 @@ def test_schema_constraint_non_singleton_06(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate function 'std::count' "
"in a non-aggregating constraint",
"cannot use SET OF function 'std::count' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_07(self):
"""
Expand All @@ -2680,8 +2680,8 @@ def test_schema_constraint_non_singleton_07(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate function 'std::count' "
"in a non-aggregating constraint",
"cannot use SET OF function 'std::count' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_08(self):
"""
Expand All @@ -2697,8 +2697,8 @@ def test_schema_constraint_non_singleton_08(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_09(self):
"""
Expand All @@ -2714,8 +2714,8 @@ def test_schema_constraint_non_singleton_09(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::DISTINCT' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::DISTINCT' "
"in a singleton constraint",
)
def test_schema_constraint_non_singleton_10(self):
"""
Expand Down Expand Up @@ -2743,8 +2743,8 @@ def test_schema_constraint_singleton_01a(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::IN' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::IN' "
"in a singleton constraint",
)
def test_schema_constraint_singleton_01b(self):
"""
Expand All @@ -2771,8 +2771,8 @@ def test_schema_constraint_singleton_02a(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::NOT IN' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::NOT IN' "
"in a singleton constraint",
)
def test_schema_constraint_singleton_02b(self):
"""
Expand All @@ -2799,8 +2799,8 @@ def test_schema_constraint_singleton_03a(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::EXISTS' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::EXISTS' "
"in a singleton constraint",
)
def test_schema_constraint_singleton_03b(self):
"""
Expand Down Expand Up @@ -2828,8 +2828,8 @@ def test_schema_constraint_singleton_04a(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
r"cannot use aggregate operator 'std::\?\?' "
r"in a non-aggregating constraint",
r"cannot use SET OF operator 'std::\?\?' "
r"in a singleton constraint",
)
def test_schema_constraint_singleton_04b(self):
"""
Expand Down Expand Up @@ -2858,8 +2858,8 @@ def test_schema_constraint_singleton_05a(self):

@tb.must_fail(
errors.UnsupportedFeatureError,
"cannot use aggregate operator 'std::IF' "
"in a non-aggregating constraint",
"cannot use SET OF operator 'std::IF' "
"in a singleton constraint",
)
def test_schema_constraint_singleton_05b(self):
"""
Expand All @@ -2876,7 +2876,7 @@ def test_schema_constraint_singleton_05b(self):

@tb.must_fail(
errors.SchemaDefinitionError,
"cannot use aggregate operator 'std::DISTINCT' "
"cannot use SET OF operator 'std::DISTINCT' "
"in an index expression",
)
def test_schema_index_non_singleton_01(self):
Expand All @@ -2890,7 +2890,7 @@ def test_schema_index_non_singleton_01(self):

@tb.must_fail(
errors.SchemaDefinitionError,
"cannot use aggregate function 'std::count' "
"cannot use SET OF function 'std::count' "
"in an index expression",
)
def test_schema_index_non_singleton_02(self):
Expand Down

0 comments on commit 473d322

Please sign in to comment.