Skip to content

Commit

Permalink
Fix test broken by merging old PR (#6221)
Browse files Browse the repository at this point in the history
I just merged #5785, and one of the tests in it is broken because
since I wrote the first PR, we started allowing computed
links/properties without specifiers.
  • Loading branch information
msullivan committed Oct 3, 2023
1 parent 2425582 commit e593646
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion edb/edgeql/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def get_verbosename_from_fqname(
assert traceobj is not None

name = str(fq_name)
clsname = traceobj.__class__.__name__.lower()
clsname = traceobj.get_schema_class_displayname()
ofobj = ''

if isinstance(traceobj, qltracer.Alias):
Expand Down Expand Up @@ -654,6 +654,8 @@ def _trace_item_layout(
qltracer.Property
if isinstance(decl, qlast.CreateConcreteProperty) else
qltracer.Link
if isinstance(decl, qlast.CreateConcreteProperty) else
qltracer.UnknownPointer
)
ptr = PointerType(
s_name.QualName('__', pn.name),
Expand Down
16 changes: 16 additions & 0 deletions edb/edgeql/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __init__(self, name: sn.QualName) -> None:
def get_name(self, schema: s_schema.Schema) -> sn.QualName:
return self.name

@classmethod
def get_schema_class_displayname(cls) -> str:
return cls.__name__.lower()


SentinelObject = NamedObject(
name=sn.QualName(module='__unknown__', name='__unknown__'),
Expand Down Expand Up @@ -257,6 +261,18 @@ def is_property(
return False


class UnknownPointer(Pointer):
def is_property(
self,
schema: s_schema.Schema,
) -> bool:
return False

@classmethod
def get_schema_class_displayname(cls) -> str:
return 'link or property'


class AccessPolicy(NamedObject):

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def test_schema_field_dupe_02(self):

@tb.must_fail(
errors.InvalidDefinitionError,
"field 'foo' .*was already declared"
"link or property 'foo' .*was already declared"
)
def test_schema_field_dupe_03(self):
"""
Expand Down

0 comments on commit e593646

Please sign in to comment.