code
stringlengths
26
870k
docstring
stringlengths
1
65.6k
func_name
stringlengths
1
194
language
stringclasses
1 value
repo
stringlengths
8
68
path
stringlengths
5
194
url
stringlengths
46
254
license
stringclasses
4 values
def test_schema_migrations_equivalence_18(self): self._assert_migration_equivalence([r""" type Base { property name := 'something' } """, r""" type Base { # change a property from a computable to regular with a default property name -> str { default := 'something' } } """])
, r
test_schema_migrations_equivalence_18
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_19(self): self._assert_migration_equivalence([r""" type Base { property name -> str } """, r""" type Base { # change a regular property to a computable property name := 'computable' } """])
, r
test_schema_migrations_equivalence_19
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_20(self): self._assert_migration_equivalence([r""" type Base { property name -> str { default := 'something' } } """, r""" type Base { # change a regular property to a computable property name := 'something' } """])
, r
test_schema_migrations_equivalence_20
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_21(self): self._assert_migration_equivalence([r""" type Base { property foo -> str; } """, r""" type Base { property foo -> str; # add a property property bar -> int64; } """, r""" type Base { # make the old property into a computable property foo := <str>__source__.bar; property bar -> int64; } """])
, r
test_schema_migrations_equivalence_21
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_22(self): self._assert_migration_equivalence([r""" type Base { property foo -> str; } """, r""" # rename the type, although this test doesn't ensure that # renaming actually took place type NewBase { property foo -> str; } """, r""" type NewBase { property foo -> str; # add a property property bar -> int64; } """, r""" type NewBase { # drop 'foo' property bar -> int64; } # add an alias to emulate the original alias Base := ( SELECT NewBase { foo := <str>.bar } ); """])
, r
test_schema_migrations_equivalence_22
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_23(self): self._assert_migration_equivalence([r""" type Child { property foo -> str; } type Base { link bar -> Child; } alias Alias01 := ( SELECT Base { child_foo := .bar.foo } ); """, r""" type Child { property foo -> str; } # exchange a type for an alias alias Base := ( SELECT Child { # bar is the same as the root object bar := Child } ); alias Alias01 := ( # now this alias refers to another alias SELECT Base { child_foo := .bar.foo } ); """])
, r
test_schema_migrations_equivalence_23
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_24(self): self._assert_migration_equivalence([r""" type Child; type Base { link bar -> Child; } """, r""" type Child; type Base { # increase link cardinality multi link bar -> Child; } """])
, r
test_schema_migrations_equivalence_24
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_26(self): self._assert_migration_equivalence([r""" type Child; type Parent { link bar -> Child; } """, r""" type Child; type Parent { link bar -> Child; } # derive a type type DerivedParent extending Parent; """, r""" type GenericChild; type Child extending GenericChild; type GenericParent { link bar -> GenericChild; } type Parent extending GenericParent { overloaded link bar -> Child; } """])
, r
test_schema_migrations_equivalence_26
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_27(self): self._assert_migration_equivalence([r""" abstract type Named { property name -> str; } type Foo extending Named; type Bar extending Named; """, r""" abstract type Named { property name -> str; } # the types stop extending named, but retain the property # 'name' type Foo { property name -> str; }; type Bar { property name -> str; }; """, r""" abstract type Named { property name -> str; } type Foo { property name -> str; }; type Bar { # rename 'name' to 'title' property title -> str; }; """])
, r
test_schema_migrations_equivalence_27
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_28(self): self._assert_migration_equivalence([r""" type Child { property foo -> str; } """, r""" # drop everything """])
, r
test_schema_migrations_equivalence_28
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_29(self): self._assert_migration_equivalence([r""" type Child { property foo -> str; } alias Base := ( SELECT Child { bar := .foo } ); """, r""" # drop everything """])
, r
test_schema_migrations_equivalence_29
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_30(self): # This is the inverse of the test_schema_migrations_equivalence_27 # scenario. We're trying to merge and refactor common # property. self._assert_migration_equivalence([r""" type Foo { property name -> str; }; type Bar { property title -> str; }; """, r""" type Foo { property name -> str; }; type Bar { # rename 'title' to 'name' property name -> str; }; """, r""" # both types have a name, so the name prop is factored out # into a more basic type. abstract type Named { property name -> str; } type Foo extending Named; type Bar extending Named; """])
, r
test_schema_migrations_equivalence_30
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_31(self): # Issue 727. # # Starting with the sample schema (from frontpage) migrate to # a schema with only type User. self._assert_migration_equivalence([r""" # This is an abstract object containing # text. abstract type Text { required property body -> str { # Maximum length of text is 10000 # characters. constraint max_len_value(10000); } } type User { required property name -> str; } abstract type Owned { # By default links are optional. required link owner -> User; } # UniquelyNamed is a an abstract type that # enforces name uniqueness across all # instances of its subtype. abstract type UniquelyNamed { required property name -> str { delegated constraint exclusive; } } type Status extending UniquelyNamed; type Priority extending UniquelyNamed; # LogEntry is an Owned and a Text, # so it will have all of their links # and properties, in particular, the # "owner" link and the "body" property. type LogEntry extending Owned, Text { required property spent_time -> int64; } type Comment extending Text, Owned { required link issue -> Issue; link parent -> Comment; } # issue_num_t is defined as a concrete # sequence type, used to generate # sequential issue numbers. scalar type issue_num_t extending sequence; type Issue extending Owned, Text { required property title -> str; required property number -> issue_num_t { # The number values are automatically # generated, and are not supposed to be # directly writable. readonly := true; } property time_estimate -> int64; property start_date -> datetime { # The default value of start_date will be a # result of the EdgeQL expression above. default := (SELECT datetime_current()); } property due_date -> datetime; required link status -> Status; link priority -> Priority; # The watchers link is mapped to User # type in many-to-many relation. multi link watchers -> User; multi link time_spent_log -> LogEntry { # Exclusive multi-link represents # a one-to-many relation. constraint exclusive; } multi link related_to -> Issue; } """, r""" type User { required property name -> str; } """])
, r
test_schema_migrations_equivalence_31
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_32(self): # Issue 727. # # Starting with a small schema migrate to remove its elements. self._assert_migration_equivalence([r""" type LogEntry { required property spent_time -> int64; } type Issue { multi link time_spent_log -> LogEntry { constraint exclusive; } } """, r""" type LogEntry { required property spent_time -> int64; } """, r""" # empty schema """])
, r
test_schema_migrations_equivalence_32
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_34(self): # this is the reverse of test_schema_migrations_equivalence_11 self._assert_migration_equivalence([r""" type Child; type Base { link foo -> Child { constraint exclusive; } } """, r""" type Base { # change link to property with same name property foo -> str; } """])
, r
test_schema_migrations_equivalence_34
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_35(self): self._assert_migration_equivalence([r""" type Child { required property name -> str; } type Base { multi link foo := ( SELECT Child FILTER .name = 'computable_35' ) } """, r""" type Child { required property name -> str; } type Base { # change a link from a computable to regular multi link foo -> Child; } """, r""" """])
, r
test_schema_migrations_equivalence_35
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_36(self): self._assert_migration_equivalence([r""" type Child { required property name -> str; } type Base { multi link foo -> Child; } """, r""" type Child { required property name -> str; } type Base { # change a regular link to a computable multi link foo := ( SELECT Child FILTER .name = 'computable_36' ) } """])
, r
test_schema_migrations_equivalence_36
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_37(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; alias BaseAlias := ( SELECT Base { foo := 'base_alias_37' } ) """, r""" type Base; alias BaseAlias := ( SELECT Base { # "rename" a computable, since the value is given and # not stored, this is no different from dropping # original and creating a new property foo2 := 'base_alias_37' } ) """])
, r
test_schema_migrations_equivalence_37
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_38(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; alias BaseAlias := ( SELECT Base { foo := 'base_alias_38' } ) """, r""" type Base; alias BaseAlias := ( SELECT Base { # keep the name, but change the type foo := 38 } ) """])
, r
test_schema_migrations_equivalence_38
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_39(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { foo := (SELECT Foo FILTER .name = 'base_alias_39') } ) """, r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { # "rename" a computable, since the value is given and # not stored, this is no different from dropping # original and creating a new multi-link foo2 := (SELECT Foo FILTER .name = 'base_alias_39') } ) """])
, r
test_schema_migrations_equivalence_39
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_40(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; type Foo { property name -> str } type Bar { property name -> str } alias BaseAlias := ( SELECT Base { foo := (SELECT Foo FILTER .name = 'foo_40') } ) """, r""" type Base; type Foo { property name -> str } type Bar { property name -> str } alias BaseAlias := ( SELECT Base { # keep the name, but change the type foo := (SELECT Bar FILTER .name = 'bar_40') } ) """])
, r
test_schema_migrations_equivalence_40
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_41(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { foo := ( SELECT Foo { @bar := 'foo_bar_alias_41' } FILTER .name = 'base_alias_41' ) } ) """, r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { foo := ( SELECT Foo { # "rename" a computable link property, since # the value is given and not stored, this is # no different from dropping original and # creating a new multi-link @baz := 'foo_bar_alias_41' } FILTER .name = 'base_alias_41' ) } ) """])
, r
test_schema_migrations_equivalence_41
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_42(self): # testing schema aliases self._assert_migration_equivalence([r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { foo := ( SELECT Foo { @bar := 'foo_bar_alias_42' } FILTER .name = 'base_alias_42' ) } ) """, r""" type Base; type Foo { property name -> str } alias BaseAlias := ( SELECT Base { foo := ( SELECT Foo { # keep the name, but change the type @bar := 42 } FILTER .name = 'base_alias_42' ) } ) """])
, r
test_schema_migrations_equivalence_42
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_43(self): # change a prop used in a computable self._assert_migration_equivalence([r""" type Foo { property val -> int64; property comp := .val + 2; }; """, r""" type Foo { property val -> float64; property comp := .val + 2; }; """])
, r
test_schema_migrations_equivalence_43
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_44(self): # change a link used in a computable self._assert_migration_equivalence([r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Post]; }; alias UserAlias := User { action_ids := .actions.id }; """, r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Action]; }; alias UserAlias := User { action_ids := .actions.id }; """])
, r
test_schema_migrations_equivalence_44
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_45(self): # change a link used in a computable self._assert_migration_equivalence([r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Post]; }; alias UserAlias := User { action_ids := .actions.id }; """, r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Post]; # Similar to previous test, but with an intermediate # step. Separating addition of a new computable and # then swapping the old one for the new one. # # Basically, we model a situation where some kind of # link "actions" has to exist throughout the entire # process (part of some interface that cannot be # easily changed maybe). multi link new_actions := .<user[IS Action]; }; alias UserAlias := User { action_ids := .actions.id, new_action_ids := .new_actions.id, }; """, r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Action]; }; alias UserAlias := User { action_ids := .actions.id }; """])
, r
test_schema_migrations_equivalence_45
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_46(self): # change a link used in a computable self._assert_migration_equivalence([r""" type Action; type Post extending Action { required link user -> User; }; type User { multi link actions := .<user[IS Post] }; alias UserAlias := User { action_ids := .actions.id }; """, r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Action] }; alias UserAlias := User { action_ids := .actions.id }; """])
, r
test_schema_migrations_equivalence_46
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_47(self): # change a link used in a computable self._assert_migration_equivalence([r""" type Action { required link user -> User; }; type Post extending Action; type User { multi link actions := .<user[IS Action] }; """, r""" type Action; type Post extending Action { required link user -> User; }; type User { multi link actions := .<user[IS Post] }; """])
, r
test_schema_migrations_equivalence_47
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_48(self): # change a link used in a computable self._assert_migration_equivalence([r""" type Action { required property name -> str; }; type Post { required property stamp -> datetime; required link user -> User; }; type User { multi link owned := .<user[IS Post] }; """, r""" type Action { required property name -> str; required link user -> User; }; type Post { required property stamp -> datetime; }; type User { multi link owned := .<user[IS Action] }; """])
, r
test_schema_migrations_equivalence_48
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_49(self): self._assert_migration_equivalence([r""" type Foo { link bars := .<foo[IS Bar]; link spam := .<foo[IS Spam]; }; type Bar { link foo -> Foo; }; type Spam { link foo -> Foo; }; """, r""" type Foo { link spam := .<foo[IS Spam]; }; type Spam { link foo -> Foo; }; """])
, r
test_schema_migrations_equivalence_49
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_50(self): self._assert_migration_equivalence([r""" type User { required property name -> str { constraint exclusive; }; index on (__subject__.name); }; """, r""" type User extending Named; abstract type Named { required property name -> str { constraint exclusive; }; index on (__subject__.name); }; """])
, r
test_schema_migrations_equivalence_50
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_51(self): self._assert_migration_equivalence([r""" abstract type Text; abstract type Owned; type Comment extending Text, Owned; """, r""" """])
, r
test_schema_migrations_equivalence_51
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_52(self): self._assert_migration_equivalence([r""" scalar type Slug extending str; type User { required property name -> str; }; """, r""" scalar type Slug extending str; abstract type Named { required property name -> Slug; }; type User extending Named; """])
, r
test_schema_migrations_equivalence_52
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_53(self): self._assert_migration_equivalence([r""" scalar type Slug extending str; abstract type Named { required property name -> Slug; }; type User { required property name -> str; }; """, r""" scalar type Slug extending str; abstract type Named { required property name -> Slug; }; type User extending Named { property foo -> str; } """])
, r
test_schema_migrations_equivalence_53
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_54(self): self._assert_migration_equivalence([r""" type User { required property name -> str; index on (__subject__.name); }; """, r""" scalar type Slug extending str; abstract type Named { required property name -> Slug; index on (__subject__.name); }; type User extending Named; """])
, r
test_schema_migrations_equivalence_54
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_55(self): self._assert_migration_equivalence([r""" type User { required property name -> str; property asdf := .name ++ "!"; }; """, r""" scalar type Slug extending str; abstract type Named { required property name -> Slug; index on (__subject__.name); }; type User extending Named { property asdf := .name ++ "!"; } """])
, r
test_schema_migrations_equivalence_55
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_57a(self): self._assert_migration_equivalence([r""" type User { required property name -> str; }; alias TwoUsers := ( select User { initial := .name[0], } order by .name limit 2 ); """, r""" type User { required property name -> str; }; alias TwoUsers := (User); """])
, r
test_schema_migrations_equivalence_57a
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_57b(self): self._assert_migration_equivalence([r""" type User { required property name -> str; }; global TwoUsers := ( select User { initial := .name[0], } order by .name limit 2 ); """, r""" type User { required property name -> str; }; global TwoUsers := (User); """])
, r
test_schema_migrations_equivalence_57b
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_58(self): self._assert_migration_equivalence([r""" abstract type C { link x -> E { constraint exclusive; } } abstract type A; type B extending A; type D extending C, A; type E extending A { link y := assert_single(.<`x`[IS C]); } """, r""" """])
, r
test_schema_migrations_equivalence_58
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_59(self): self._assert_migration_equivalence([r""" type User { required property name -> str; index pg::spgist on (.name); }; """, r""" type User { required property name -> str; index pg::spgist on (.name) { annotation description := 'test'; }; }; """, r""" type User { required property name -> str; }; """])
, r
test_schema_migrations_equivalence_59
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_60(self): self._assert_migration_equivalence( [ r""" type User { required property name -> str; }; """, r""" type User { required property name -> str; index pg::spgist on (.name); }; """, r""" type User { required property name -> str; index pg::spgist on (.name) { annotation description := 'test'; }; }; """, ] )
, r
test_schema_migrations_equivalence_60
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_61(self): self._assert_migration_equivalence( [ r""" type Child { property foo -> str; } type Base { link bar -> Child; } """, r""" type Child { property foo -> str; } # exchange a type for an alias alias Base := ( SELECT Child { # bar is the same as the root object bar := Child } ); """, ] )
, r
test_schema_migrations_equivalence_61
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constr_rebase_01(self): self._assert_migration_equivalence( [ r""" abstract type Foo; type Bar { required property baz -> str { constraint max_len_value(280); } } """, r""" abstract type Foo; type Bar extending Foo { required property baz -> str { constraint max_len_value(280); } } """, r""" abstract type Foo; type Bar { required property baz -> str { constraint max_len_value(280); } } """, ] )
, r
test_schema_migrations_equivalence_constr_rebase_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_compound_01(self): # Check that union types can be referenced in computables # Bug #2002. self._assert_migration_equivalence([r""" type Type1; type Type2; type Type3 { link l1 -> (Type1 | Type2); link l2 := (SELECT .l1); }; """, r""" type Type11; # Rename type Type2; type Type3 { link l1 -> (Type11 | Type2); link l2 := (SELECT .l1); }; """, r""" type Type11; type Type2; type TypeS; type Type3 { link l1 -> (Type11 | Type2 | TypeS); # Expand union link l2 := (SELECT .l1); }; """, r""" """])
, r
test_schema_migrations_equivalence_compound_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_01(self): self._assert_migration_equivalence([r""" function hello01(a: int64) -> str using ( SELECT 'hello' ++ <str>a ) """, r""" function hello01(a: int64, b: int64=42) -> str using ( SELECT 'hello' ++ <str>(a + b) ) """])
, r
test_schema_migrations_equivalence_function_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_04(self): self._assert_migration_equivalence([r""" function foo() -> str USING ('foo'); """, r""" function foo() -> str USING ('bar'); """])
, r
test_schema_migrations_equivalence_function_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_06(self): self._assert_migration_equivalence([r""" function hello06(a: int64) -> str using edgeql $$ SELECT <str>a $$; type Base { property foo -> int64 { # use the function in default value computation default := len(hello06(2) ++ hello06(123)) } } """, r""" function hello06(a: int64) -> array<int64> using ( SELECT [a] ); type Base { property foo -> int64 { # use the function in default value computation default := len(hello06(2) ++ hello06(123)) } } """])
, r
test_schema_migrations_equivalence_function_06
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_10(self): self._assert_migration_equivalence([r""" function hello10(a: int64) -> str using edgeql $$ SELECT <str>a $$; type Base { required property foo -> int64 { # use the function in a constraint expression constraint expression on (len(hello10(__subject__)) < 2) } } """, r""" function hello10(a: int64) -> array<int64> using ( SELECT [a] ); type Base { required property foo -> int64 { # use the function in a constraint expression constraint expression on (len(hello10(__subject__)) < 2) } } """])
, r
test_schema_migrations_equivalence_function_10
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_11(self): self._assert_migration_equivalence([r""" function hello11(a: int64) -> str using edgeql $$ SELECT 'hello' ++ <str>a $$ """, r""" # replace the function with a new one by the same name function hello11(a: str) -> str using ( SELECT 'hello' ++ a ) """])
, r
test_schema_migrations_equivalence_function_11
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_12(self): self._assert_migration_equivalence([r""" function hello12(a: int64) -> str using edgeql $$ SELECT 'hello' ++ <str>a $$; """, r""" function hello12(a: int64) -> str using ( SELECT 'hello' ++ <str>a ); # make the function polymorphic function hello12(a: str) -> str using ( SELECT 'hello' ++ a ); """])
, r
test_schema_migrations_equivalence_function_12
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_13(self): # this is the inverse of test_schema_migrations_equivalence_function_12 self._assert_migration_equivalence([r""" # start with a polymorphic function function hello13(a: int64) -> str using edgeql $$ SELECT 'hello' ++ <str>a $$; function hello13(a: str) -> str using edgeql $$ SELECT 'hello' ++ a $$; """, r""" # remove one of the 2 versions function hello13(a: int64) -> str using ( SELECT 'hello' ++ <str>a ); """])
, r
test_schema_migrations_equivalence_function_13
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_14(self): self._assert_migration_equivalence([r""" function hello14(a: str, b: str) -> str using ( SELECT a ++ b ) """, r""" # Replace the function with a new one by the same name, # but working with arrays. function hello14(a: array<str>, b: array<str>) -> array<str> using ( SELECT a ++ b ) """])
, r
test_schema_migrations_equivalence_function_14
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_15(self): self._assert_migration_equivalence([r""" function hello15(a: str, b: str) -> str using ( SELECT a ++ b ) """, r""" # Replace the function with a new one by the same name, # but working with arrays. function hello15(a: tuple<str, str>) -> str using ( SELECT a.0 ++ a.1 ) """])
, r
test_schema_migrations_equivalence_function_15
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_16(self): # change prop type without changing the affected function. self._assert_migration_equivalence([r""" type Foo { property bar -> array<int64>; }; function hello16() -> optional int64 using ( SELECT len((SELECT Foo LIMIT 1).bar) ) """, r""" type Foo { property bar -> array<float64>; }; function hello16() -> optional int64 using ( SELECT len((SELECT Foo LIMIT 1).bar) ) """])
, r
test_schema_migrations_equivalence_function_16
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_17(self): # change prop type without changing the affected function. self._assert_migration_equivalence([r""" type Foo { property bar -> array<int64>; }; type Bar; function hello17() -> optional Bar using ( SELECT Bar OFFSET len((SELECT Foo.bar LIMIT 1)) ?? 0 LIMIT 1 ) """, r""" type Foo { property bar -> array<float64>; }; type Bar; function hello17() -> optional Bar using ( SELECT Bar OFFSET len((SELECT Foo.bar LIMIT 1)) ?? 0 LIMIT 1 ) """])
, r
test_schema_migrations_equivalence_function_17
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_18(self): self._assert_migration_equivalence([r""" function a() -> float64 { using ( SELECT random() ) } """, r""" function a() -> float64 { volatility := "volatile"; using ( SELECT random() ) } """])
, r
test_schema_migrations_equivalence_function_18
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_19(self): self._assert_migration_equivalence([r""" function a() -> float64 { volatility := "volatile"; using ( SELECT random() ) } """, r""" function a() -> float64 { using ( SELECT random() ) } """])
, r
test_schema_migrations_equivalence_function_19
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_20(self): self._assert_migration_equivalence([r""" function a() -> float64 { volatility := "volatile"; using ( SELECT 1.0 ) } """, r""" function a() -> float64 { using ( SELECT 1.0 ) } """])
, r
test_schema_migrations_equivalence_function_20
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_function_21(self): self._assert_migration_equivalence([r""" function foo(variadic s: str) -> str using ("!"); """, r""" function foo(variadic s: str) -> str using ("?"); """])
, r
test_schema_migrations_equivalence_function_21
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_01(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, "property 'val' of object type 'default::Foo' " "is defined recursively" ): self._assert_migration_equivalence([r""" type Foo { link next -> Foo; property val := 1; } """, r""" type Foo { link next -> Foo; property val := 1 + (.next.val ?? 0); } """])
, r
test_schema_migrations_equivalence_recursive_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_02(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, "definition dependency cycle between " "property 'val' of object type 'default::Foo' and " "property 'val' of object type 'default::Bar'" ): self._assert_migration_equivalence([r""" type Foo { link next -> Bar; property val := 1; } type Bar { link next -> Foo; property val := 1; } """, r""" type Foo { link next -> Bar; property val := 1 + (.next.val ?? 0); } type Bar { link next -> Foo; property val := 1; } """, r""" type Foo { link next -> Bar; property val := 1 + (.next.val ?? 0); } type Bar { link next -> Foo; property val := 1 + (.next.val ?? 0); } """])
, r
test_schema_migrations_equivalence_recursive_02
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_03(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, r"function 'default::foo\(v: int64\)' " r"is defined recursively" ): self._assert_migration_equivalence([r""" function foo(v: int64) -> int64 using ( 1 + v ); """, r""" function foo(v: int64) -> int64 using ( 0 IF v < 0 ELSE 1 + foo(v -1) ); """])
, r
test_schema_migrations_equivalence_recursive_03
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_04(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, r"definition dependency cycle between " r"function 'default::bar\(v: int64\)' and " r"function 'default::foo\(v: int64\)'" ): self._assert_migration_equivalence([r""" function foo(v: int64) -> int64 using ( 1 + v ); function bar(v: int64) -> int64 using ( 0 IF v < 0 ELSE 1 + foo(v -1) ); """, r""" function foo(v: int64) -> int64 using ( 0 IF v < 0 ELSE 1 + bar(v -1) ); function bar(v: int64) -> int64 using ( 0 IF v < 0 ELSE 1 + foo(v -1) ); """])
, r
test_schema_migrations_equivalence_recursive_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_05(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, r"definition dependency cycle between " r"function 'default::foo\(v: int64\)' and " r"property 'val' of object type 'default::Foo'" ): self._assert_migration_equivalence([r""" type Foo { property val := foo(1); } function foo(v: int64) -> int64 using ( 1 + v ); """, r""" type Foo { property val := foo(1); } function foo(v: int64) -> int64 using ( # This is very broken now 1 + (SELECT Foo LIMIT 1).val ); """])
, r
test_schema_migrations_equivalence_recursive_05
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_06(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, r"definition dependency cycle between " r"function 'default::foo\(v: int64\)' and " r"property 'val' of object type 'default::Foo'" ): self._assert_migration_equivalence([r""" type Foo { property val := 1; } function foo(v: int64) -> optional int64 using ( 1 + (SELECT Foo LIMIT 1).val ); """, r""" type Foo { # This is very broken now property val := foo(1); } function foo(v: int64) -> optional int64 using ( 1 + (SELECT Foo LIMIT 1).val ); """])
, r
test_schema_migrations_equivalence_recursive_06
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_07(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, "definition dependency cycle between " "alias 'default::FooAlias1' and alias 'default::FooAlias0'" ): self._assert_migration_equivalence([r""" type Foo { property val -> int64; } alias FooAlias0 := Foo { comp := .val + (SELECT FooAlias1 LIMIT 1).comp }; alias FooAlias1 := Foo { comp := .val + 1 }; """, r""" type Foo { property val -> int64; } alias FooAlias0 := Foo { comp := .val + (SELECT FooAlias1 LIMIT 1).comp }; alias FooAlias1 := Foo { comp := .val + (SELECT FooAlias0 LIMIT 1).comp }; """])
, r
test_schema_migrations_equivalence_recursive_07
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_recursive_08(self): with self.assertRaisesRegex( errors.InvalidDefinitionError, "'default::Foo' is defined recursively" ): self._assert_migration_equivalence([r""" type Foo; type Bar extending Foo; """, r""" type Foo extending Bar; type Bar extending Foo; """])
, r
test_schema_migrations_equivalence_recursive_08
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_computed_01(self): self._assert_migration_equivalence([r""" type Foo { property x := 10; }; """, r""" type Foo { single property x := 10; }; """, r""" type Foo { multi property x := 10; }; """])
, r
test_schema_migrations_equivalence_computed_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_computed_02(self): self._assert_migration_equivalence([r""" type Foo { single property x := 10; }; """, r""" type Foo { property x := 10; }; """, r""" type Foo { multi property x := 10; }; """])
, r
test_schema_migrations_equivalence_computed_02
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_03(self): self._assert_migration_equivalence([r""" type Child; type Base { link foo -> Child { property bar -> int64 } }; """, r""" type Child; type Base { link foo -> Child { # change the link property type property bar -> int32 } }; """])
, r
test_schema_migrations_equivalence_linkprops_03
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_07(self): self._assert_migration_equivalence([r""" type Child; type Base { link child -> Child }; type Derived extending Base { overloaded link child -> Child { property foo -> str } }; """, r""" type Child; type Base { # move the link property earlier in the inheritance tree link child -> Child { property foo -> str } }; type Derived extending Base; """])
, r
test_schema_migrations_equivalence_linkprops_07
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_08(self): self._assert_migration_equivalence([r""" type Child; type Base { link child -> Child { property foo -> str } }; type Derived extending Base; """, r""" type Child; type Base { link child -> Child }; type Derived extending Base { overloaded link child -> Child { # move the link property later in the inheritance tree property foo -> str } }; """, r""" """])
, r
test_schema_migrations_equivalence_linkprops_08
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_09(self): self._assert_migration_equivalence([r""" type Child; type Base { link child -> Child }; type Derived extending Base { overloaded link child -> Child { property foo -> str } }; """, r""" type Child; # factor out link property all the way to an abstract link abstract link base_child { property foo -> str; } type Base { link child extending base_child -> Child; }; type Derived extending Base; """])
, r
test_schema_migrations_equivalence_linkprops_09
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_10(self): self._assert_migration_equivalence([r""" type Child; abstract link base_child { property foo -> str; } type Base { link child extending base_child -> Child; }; type Derived extending Base; """, r""" type Child; type Base { link child -> Child }; type Derived extending Base { overloaded link child -> Child { # move the link property later in the inheritance tree property foo -> str } }; """, r""" """])
, r
test_schema_migrations_equivalence_linkprops_10
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_11(self): self._assert_migration_equivalence([r""" type Thing; type Owner { link item -> Thing { property foo -> str; } }; type Renter { link item -> Thing { property foo -> str; } }; """, r""" type Thing; type Base { link item -> Thing { property foo -> str; } }; type Owner extending Base; type Renter extending Base; """])
, r
test_schema_migrations_equivalence_linkprops_11
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_12(self): self._assert_migration_equivalence([r""" type Thing; type Owner { link item -> Thing { property foo -> str; } }; type Renter { link item -> Thing { property bar -> str; } }; """, r""" type Thing; type Base { link item -> Thing { property foo -> str; property bar -> str; } }; type Owner extending Base; type Renter extending Base; """])
, r
test_schema_migrations_equivalence_linkprops_12
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_13(self): self._assert_migration_equivalence([r""" type Child; type Base { link child -> Child }; type Derived extending Base { overloaded link child -> Child { property foo -> str } }; """, r""" type Child; type Base { link child -> Child { property foo -> str } }; type Derived extending Base; """, r""" """])
, r
test_schema_migrations_equivalence_linkprops_13
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_linkprops_14(self): self._assert_migration_equivalence([r""" abstract link link_with_value { single property value -> int64; index on (__subject__@value); } type Tgt; type Foo { link l1 extending link_with_value -> Tgt; link l2 -> Tgt { property value -> int64; index on (__subject__@value); index on ((__subject__@target, __subject__@value)); }; }; """, r""" abstract link link_with_value { single property value -> int64; index on (__subject__@value); index on ((__subject__@target, __subject__@value)); } type Tgt; type Foo { link l1 extending link_with_value -> Tgt; link l2 -> Tgt { property value -> int64; index on (__subject__@value) { annotation title := "value!"; } }; }; """])
, r
test_schema_migrations_equivalence_linkprops_14
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_01(self): self._assert_migration_equivalence([r""" type Base; """, r""" type Base { # add a title annotation annotation title := 'Base description 01' } """, r""" # add inheritable and non-inheritable annotations abstract annotation foo_anno; abstract inheritable annotation bar_anno; type Base { annotation title := 'Base description 01'; annotation foo_anno := 'Base foo_anno 01'; annotation bar_anno := 'Base bar_anno 01'; } """, r""" abstract annotation foo_anno; abstract inheritable annotation bar_anno; type Base { annotation title := 'Base description 01'; annotation foo_anno := 'Base foo_anno 01'; annotation bar_anno := 'Base bar_anno 01'; } # extend Base type Derived extending Base; """])
, r
test_schema_migrations_equivalence_annotation_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_02(self): self._assert_migration_equivalence([r""" type Base; """, r""" abstract annotation foo_anno; type Base { annotation title := 'Base description 02'; annotation foo_anno := 'Base foo_anno 02'; } type Derived extending Base; """, r""" # remove foo_anno type Base { annotation title := 'Base description 02'; } type Derived extending Base; """])
, r
test_schema_migrations_equivalence_annotation_02
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_03(self): self._assert_migration_equivalence([r""" type Base; """, r""" abstract inheritable annotation bar_anno; type Base { annotation title := 'Base description 03'; annotation bar_anno := 'Base bar_anno 03'; } type Derived extending Base; """, r""" # remove bar_anno type Base { annotation title := 'Base description 03'; } type Derived extending Base; """])
, r
test_schema_migrations_equivalence_annotation_03
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_04(self): self._assert_migration_equivalence([r""" type Base; """, r""" abstract inheritable annotation bar_anno; type Base { annotation bar_anno := 'Base bar_anno 04'; } type Derived extending Base; """, r""" # rename bar_anno -> foo_anno abstract inheritable annotation foo_anno; type Base { annotation foo_anno := 'Base bar_anno 04'; } type Derived extending Base; """])
, r
test_schema_migrations_equivalence_annotation_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_05(self): self._assert_migration_equivalence([r""" abstract inheritable annotation my_anno; type Base { property my_prop -> str { annotation my_anno := 'Base my_anno 05'; } } type Derived extending Base { overloaded property my_prop -> str { annotation my_anno := 'Derived my_anno 05'; } } """, r""" # rename annotated & inherited property abstract inheritable annotation my_anno; type Base { property renamed_prop -> str { annotation my_anno := 'Base my_anno 05'; } } type Derived extending Base { overloaded property renamed_prop -> str { annotation my_anno := 'Derived my_anno 05'; } } """, r""" """])
, r
test_schema_migrations_equivalence_annotation_05
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_06(self): self._assert_migration_equivalence([r""" abstract inheritable annotation my_anno; type Base { link my_link -> Object { annotation my_anno := 'Base my_anno 06'; } } type Derived extending Base { overloaded link my_link -> Object { annotation my_anno := 'Derived my_anno 06'; } } """, r""" # rename annotated & inherited link abstract inheritable annotation my_anno; type Base { link renamed_link -> Object { annotation my_anno := 'Base my_anno 06'; } } type Derived extending Base { overloaded link renamed_link -> Object { annotation my_anno := 'Derived my_anno 06'; } } """, r""" """])
, r
test_schema_migrations_equivalence_annotation_06
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_07(self): self._assert_migration_equivalence([r""" abstract inheritable annotation my_anno; type Base { link my_link -> Object { annotation my_anno := 'Base my_anno 06'; } } type Derived extending Base { overloaded link my_link -> Object { annotation my_anno := 'Derived my_anno 06'; } } """, r""" abstract inheritable annotation my_anno; type Base { link my_link -> Object { annotation my_anno := 'Base my_anno 06'; } } type Derived extending Base; """, r""" """])
, r
test_schema_migrations_equivalence_annotation_07
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_annotation_08(self): self._assert_migration_equivalence([r""" abstract annotation ann1; type T { annotation ann1 := 'test!'; }; """, r""" abstract annotation ann2; type T { annotation ann2 := 'test?'; }; """])
, r
test_schema_migrations_equivalence_annotation_08
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_01(self): self._assert_migration_equivalence([r""" type Base { property name -> str; } """, r""" type Base { property name -> str; # an index index on (.name); } """, r""" type Base { # rename the indexed property property title -> str; index on (.title); } """])
, r
test_schema_migrations_equivalence_index_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_02(self): self._assert_migration_equivalence([r""" type Base { property name -> str; index on (.name); } """, r""" type Base { property name -> str; # remove the index } """])
, r
test_schema_migrations_equivalence_index_02
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_03(self): self._assert_migration_equivalence([r""" type Base { property name -> int64; } """, r""" type Base { property name -> int64; # an index index on (.name); } """, r""" type Base { # change the indexed property type property name -> int32; index on (.name); } """])
, r
test_schema_migrations_equivalence_index_03
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_04(self): self._assert_migration_equivalence( [ r""" type Base { property first_name -> str; property last_name -> str; property name := .first_name ++ ' ' ++ .last_name; } """, r""" type Base { property first_name -> str; property last_name -> str; property name := .first_name ++ ' ' ++ .last_name; # an index on a computable index fts::index on ( fts::with_options(.name, language := fts::Language.eng) ); } """, ] )
, r
test_schema_migrations_equivalence_index_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_05(self): self._assert_migration_equivalence([r""" type Base { property first_name -> str; index on (.first_name); } """, r""" type Base { property first_name -> str; index on (.first_name) { # add annotation annotation title := 'index on first name'; } } """, r""" type Base { property first_name -> str; # drop index } """])
, r
test_schema_migrations_equivalence_index_05
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_index_06(self): self._assert_migration_equivalence([r""" type Base { required property name -> str; required property year -> int64; index on ((.name, .year)); } """, r""" type Base { required property name -> str; required property year -> int64; index on ((.year, .name)); } """])
, r
test_schema_migrations_equivalence_index_06
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_01(self): self._assert_migration_equivalence([r""" type Base { property first_name -> str { constraint max_len_value(10) } } """, r""" type Base { property first_name -> str { constraint max_len_value(10) { # add annotation annotation title := 'constraint on first name'; } } } """, r""" type Base { property first_name -> str; # drop constraint } """])
, r
test_schema_migrations_equivalence_constraint_01
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_02(self): self._assert_migration_equivalence([r""" type Base { property firstname -> str { constraint max_len_value(10) } } type Derived extending Base; """, r""" # rename constrained & inherited property type Base { property first_name -> str { constraint max_len_value(10) } } type Derived extending Base; """])
, r
test_schema_migrations_equivalence_constraint_02
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_03(self): self._assert_migration_equivalence([r""" abstract constraint Lol { using (__subject__ < 10) }; type Foo { property x -> int64 { constraint Lol; } } type Bar extending Foo; """, r""" abstract constraint Lolol { using (__subject__ < 10) }; type Foo { property x -> int64 { constraint Lolol; } } type Bar extending Foo; """])
, r
test_schema_migrations_equivalence_constraint_03
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_04(self): self._assert_migration_equivalence([r""" type Base { property firstname -> str { constraint max_len_value(10); } } type Derived extending Base { overloaded property firstname -> str { # add another constraint to make the prop overloaded constraint min_len_value(5); } } """, r""" # rename constrained & inherited property type Base { property first_name -> str { constraint max_len_value(10); } } type Derived extending Base { overloaded property first_name -> str { constraint min_len_value(5); } } """, r""" """])
, r
test_schema_migrations_equivalence_constraint_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_05(self): self._assert_migration_equivalence([r""" abstract constraint not_bad { using (__subject__ != "bad" and __subject__ != "terrible") } type Foo { property x -> str { constraint not_bad; } } type Bar extending Foo; """, r""" abstract constraint not_bad { using (__subject__ != "bad" and __subject__ != "awful") } type Foo { property x -> str { constraint not_bad; } } type Bar extending Foo; """])
, r
test_schema_migrations_equivalence_constraint_05
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_06(self): self._assert_migration_equivalence([r""" type Cell { link right -> Cell; # `left` is inferred to be multi link left := .<right[IS Cell]; } """, r""" type Cell { link right -> Cell { # Add the constraint to make it 1-1 constraint exclusive; } # This should now be inferred as single link left := .<right[IS Cell]; } """])
, r
test_schema_migrations_equivalence_constraint_06
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_07(self): self._assert_migration_equivalence([r""" type Cell { link right -> Cell; # `left` is inferred to be multi link left := .<right[IS Cell]; } """, r""" type Cell { link right -> Cell { # Add the constraint to make it 1-1 constraint exclusive; } # Explicitly single link single link left := .<right[IS Cell]; } """])
, r
test_schema_migrations_equivalence_constraint_07
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0
def test_schema_migrations_equivalence_constraint_08(self): self._assert_migration_equivalence([r""" type Cell { link right -> Cell; multi link left := .<right[IS Cell]; } """, r""" type Cell { link right -> Cell { # Add the constraint to make it 1-1 constraint exclusive; } multi link left := .<right[IS Cell]; } """, r""" type Cell { link right -> Cell { constraint exclusive; } # Now switch to a single link single link left := .<right[IS Cell]; } """])
, r
test_schema_migrations_equivalence_constraint_08
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0