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_constraint_09(self): self._assert_migration_equivalence([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""" type Cell { link right -> Cell; # Explicitly multi link multi link left := .<right[IS Cell]; } """])
, r
test_schema_migrations_equivalence_constraint_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_constraint_10(self): self._assert_migration_equivalence([r""" type Cell { link right -> Cell { # Add the constraint to make it 1-1 constraint exclusive; } link left := .<right[IS Cell]; } """, r""" type Cell { link right -> Cell; link left := .<right[IS Cell]; } """])
, r
test_schema_migrations_equivalence_constraint_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_constraint_11(self): self._assert_migration_equivalence([r""" type Foo { required property name -> str { constraint max_len_value(200) { errmessage := "name is too long"; } } constraint exclusive on (.name) { errmessage := "exclusivity!"; } } """, r""" type Foo { required property name -> str { constraint max_len_value(201) { errmessage := "name is too long"; } } constraint exclusive on (.name) { errmessage := "exclusivity!"; } } """, r""" type Foo { required property name -> str; constraint exclusive on (.name) { errmessage := "exclusivity!"; } } """])
, r
test_schema_migrations_equivalence_constraint_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_policies_01(self): self._assert_migration_equivalence([r""" type X { required property x -> str; access policy test allow all using (.x not like '%redacted%'); }; """, r""" type X { required property x -> str; access policy asdf allow all using (.x not like '%redacted%'); }; """, r""" type X { required property x -> str; access policy asdf when (true) allow all using (.x not like '%redacted%'); }; """])
, r
test_schema_migrations_equivalence_policies_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_policies_03(self): self._assert_migration_equivalence([r""" type Foo { access policy asdf allow all using (true); } """, """ type Foo { access policy asdf allow all; } """])
,
test_schema_migrations_equivalence_policies_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_globals_01(self): self._assert_migration_equivalence([r""" global foo -> str; """, r""" required global foo -> str { default := "test"; } """, r""" required global foo -> int64 { default := 0 + 1; } """])
, r
test_schema_migrations_equivalence_globals_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_globals_02(self): self._assert_migration_equivalence([r""" global foo -> str; """, r""" global foo -> str { default := "test"; } """, r""" global foo := "test"; """, r""" global foo := 10; """, r""" global bar := 10; """, r""" required global bar := 10; """, r""" required multi global bar := 10; """, r""" global bar -> str; """])
, r
test_schema_migrations_equivalence_globals_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_globals_03(self): self._assert_migration_equivalence([r""" global foo := 20; """, r""" alias foo := 20; """, r""" global foo := 20; """])
, r
test_schema_migrations_equivalence_globals_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_globals_04(self): self._assert_migration_equivalence([r""" global foo -> str """, r""" global foo := 20; """, r""" global foo -> int64; """])
, r
test_schema_migrations_equivalence_globals_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_globals_use_01(self): self._assert_migration_equivalence([r""" global current -> uuid; type Foo { property name -> str; }; alias CurFoo := (select Foo filter .id = global current) """, r""" global current_foo -> uuid; type Foo { property name -> str; }; alias CurFoo := (select Foo filter .id = global current_foo) """])
, r
test_schema_migrations_equivalence_globals_use_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_globals_funcs_02(self): schema1, schema2, _ = self._assert_migration_equivalence([r""" required global foo -> int64 { default := 0}; required global bar -> int64 { default := 0}; function f1() -> int64 using (global foo); function f2() -> int64 using (f1()); """, r""" required global foo -> int64 { default := 0}; required global bar -> int64 { default := 0}; function f1() -> int64 using (global foo + global bar); function f2() -> int64 using (f1()); """]) self.assertEqual( schema1.get_functions('default::f2'), schema2.get_functions('default::f2'), "function got deleted/recreated and should have been altered", )
, r
test_schema_migrations_equivalence_globals_funcs_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_collections_01(self): self._assert_migration_equivalence([r""" type Base; """, r""" type Base { property foo -> array<float32>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_02(self): self._assert_migration_equivalence([r""" type Base; """, r""" type Base { property foo -> tuple<str, int32>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_03(self): self._assert_migration_equivalence([r""" type Base; """, r""" type Base { # nested collection property foo -> tuple<str, int32, array<float32>>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_04(self): self._assert_migration_equivalence([r""" type Base; """, r""" type Base { property foo -> tuple<a: str, b: int32>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_06(self): self._assert_migration_equivalence([r""" type Base { property foo -> array<int32>; } """, r""" type Base { # change the array type (old type is castable into new) property foo -> array<float64>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_08(self): self._assert_migration_equivalence([r""" type Base { property foo -> tuple<int32, int32>; } """, r""" type Base { # convert property type to a tuple with different (but # cast-compatible) element types property foo -> tuple<int64, int32>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_09(self): self._assert_migration_equivalence([r""" type Base { property foo -> tuple<str, int32>; } """, r""" type Base { # convert property type from unnamed to named tuple property foo -> tuple<a: str, b: int32>; } """])
, r
test_schema_migrations_equivalence_collections_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_collections_10(self): # This is trying to validate that the error message is # sensible. There was a bug that caused an unhelpful error # message to appear due to incomplete dependency resolution # and incorrect DDL sorting for this migration. with self.assertRaisesRegex( errors.InvalidPropertyTargetError, "expected a scalar type, or a scalar collection, " "got collection 'array<default::Foo>'"): self._assert_migration_equivalence([r""" type Base; type Foo; """, r""" type Base { property foo -> array<Foo>; } type Foo; """])
, r
test_schema_migrations_equivalence_collections_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_collections_11(self): # This is trying to validate that the error message is # sensible. There was a bug that caused an unhelpful error # message to appear due to incomplete dependency resolution # and incorrect DDL sorting for this migration. with self.assertRaisesRegex( errors.InvalidPropertyTargetError, "expected a scalar type, or a scalar collection, " "got collection 'tuple<std::str, default::Foo>'"): self._assert_migration_equivalence([r""" type Base; type Foo; """, r""" type Base { property foo -> tuple<str, Foo>; } type Foo; """])
, r
test_schema_migrations_equivalence_collections_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_collections_12(self): # This is trying to validate that the error message is # sensible. There was a bug that caused an unhelpful error # message to appear due to incomplete dependency resolution # and incorrect DDL sorting for this migration. with self.assertRaisesRegex( errors.InvalidPropertyTargetError, "expected a scalar type, or a scalar collection, " "got collection 'array<default::Foo>'"): self._assert_migration_equivalence([r""" type Base { property foo -> array<Foo>; } type Foo; """, r""" type Base { property foo -> array<Foo>; # nested collection property bar -> tuple<str, array<Foo>>; } type Foo; """])
, r
test_schema_migrations_equivalence_collections_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_collections_13(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property foo -> float32; }; # aliases that don't have arrays alias BaseAlias := Base { bar := Base.foo }; alias CollAlias := Base.foo; """, r""" type Base { property foo -> float32; }; # "same" aliases that now have arrays alias BaseAlias := Base { bar := [Base.foo] }; alias CollAlias := [Base.foo]; """])
, r
test_schema_migrations_equivalence_collections_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_collections_14(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property foo -> float32; }; # aliases that don't have tuples alias BaseAlias := Base { bar := Base.foo }; alias CollAlias := Base.foo; """, r""" type Base { property name -> str; property foo -> float32; }; # "same" aliases that now have tuples alias BaseAlias := Base { bar := (Base.name, Base.foo) }; alias CollAlias := (Base.name, Base.foo); """])
, r
test_schema_migrations_equivalence_collections_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_collections_15(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # aliases that don't have nested collections alias BaseAlias := Base { bar := Base.foo }; alias CollAlias := Base.foo; """, r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # "same" aliases that now have nested collections alias BaseAlias := Base { bar := (Base.name, Base.number, [Base.foo]) }; alias CollAlias := (Base.name, Base.number, [Base.foo]); """, r""" """])
, r
test_schema_migrations_equivalence_collections_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_collections_16(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property foo -> float32; }; # aliases that don't have named tuples alias BaseAlias := Base { bar := Base.foo }; alias CollAlias := Base.foo; """, r""" type Base { property name -> str; property foo -> float32; }; # "same" aliases that now have named tuples alias BaseAlias := Base { bar := (a := Base.name, b := Base.foo) }; alias CollAlias := (a := Base.name, b := Base.foo); """])
, r
test_schema_migrations_equivalence_collections_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_collections_17(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property foo -> float32; property bar -> int32; }; # aliases with array<int32> alias BaseAlias := Base { data := [Base.bar] }; alias CollAlias := [Base.bar]; """, r""" type Base { property foo -> float32; property bar -> int32; }; # aliases with array<float32> alias BaseAlias := Base { data := [Base.foo] }; alias CollAlias := [Base.foo]; """])
, r
test_schema_migrations_equivalence_collections_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_collections_18(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # aliases with tuple<str, int32> alias BaseAlias := Base { data := (Base.name, Base.number) }; alias CollAlias := (Base.name, Base.number); """, r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # aliases with tuple<str, int32, float32> alias BaseAlias := Base { data := (Base.name, Base.number, Base.foo) }; alias CollAlias := (Base.name, Base.number, Base.foo); """])
, r
test_schema_migrations_equivalence_collections_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_collections_20(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # aliases with tuple<str, int32> alias BaseAlias := Base { data := (Base.name, Base.number) }; alias CollAlias := (Base.name, Base.number); """, r""" type Base { property name -> str; property number -> int32; property foo -> float32; }; # aliases with tuple<str, float32> alias BaseAlias := Base { data := (Base.name, Base.foo) }; alias CollAlias := (Base.name, Base.foo); """])
, r
test_schema_migrations_equivalence_collections_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_collections_21(self): # schema aliases & collection test self._assert_migration_equivalence([r""" type Base { property name -> str; property foo -> float32; }; # aliases with tuple<str, float32> alias BaseAlias := Base { data := (Base.name, Base.foo) }; alias CollAlias := (Base.name, Base.foo); """, r""" type Base { property name -> str; property foo -> float32; }; # aliases with named tuple<a: str, b: float32> alias BaseAlias := Base { data := (a := Base.name, b := Base.foo) }; alias CollAlias := (a := Base.name, b := Base.foo); """])
, r
test_schema_migrations_equivalence_collections_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_collections_22(self): # change prop type without changing the affected expression. self._assert_migration_equivalence([r""" type Foo { property bar -> array<int64>; }; type Bar { property val -> int64 { default := len((SELECT Foo LIMIT 1).bar) }; }; """, r""" type Foo { property bar -> array<float64>; }; type Bar { property val -> int64 { default := len((SELECT Foo LIMIT 1).bar) }; }; """])
, r
test_schema_migrations_equivalence_collections_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_collections_23(self): self._assert_migration_equivalence([r""" scalar type MyScalar extending str; type User { required property tup -> tuple<x:MyScalar>; }; """, r""" scalar type MyScalar extending str; type User { required property tup -> tuple<x:str>; }; """])
, r
test_schema_migrations_equivalence_collections_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_collections_24(self): self._assert_migration_equivalence([r""" scalar type MyScalar extending str; type User { required property tup -> tuple<x:MyScalar>; }; """, r""" scalar type MyScalarRenamed extending str; type User { required property tup -> tuple<x:MyScalarRenamed>; }; """])
, r
test_schema_migrations_equivalence_collections_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_collections_25(self): self._assert_migration_equivalence([r""" scalar type MyScalar extending str; type User { required property arr -> array<MyScalar>; }; """, r""" scalar type MyScalarRenamed extending str; type User { required property tup -> array<MyScalarRenamed>; }; """])
, r
test_schema_migrations_equivalence_collections_25
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_collections_26(self): self._assert_migration_equivalence([r""" scalar type MyScalar extending str; scalar type MyScalar2 extending int64; type User { required property tup -> tuple< a: tuple<x:MyScalar>, b: MyScalar, c: array<MyScalar2>, d: tuple<array<MyScalar2>>, >; }; """, r""" scalar type MyScalarRenamed extending str; scalar type MyScalar2Renamed extending int64; type User { required property tup -> tuple< a: tuple<x:MyScalarRenamed>, b: MyScalarRenamed, c: array<MyScalar2Renamed>, d: tuple<array<MyScalar2Renamed>>, >; }; """, r""" """])
, r
test_schema_migrations_equivalence_collections_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_collections_27(self): self._assert_migration_equivalence([r""" """, r""" scalar type MyScalar2Renamed extending int64; type User { required property tup -> tuple< c: array<MyScalar2Renamed>, d: array<MyScalar2Renamed>, >; }; """, r""" """])
, r
test_schema_migrations_equivalence_collections_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_rename_refs_01(self): self._assert_migration_equivalence([r""" type Note { required property remark -> str; constraint exclusive on (__subject__.remark); }; """, r""" type Note { required property note -> str; constraint exclusive on (__subject__.note); }; """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_02(self): self._assert_migration_equivalence([r""" type Note { required property remark -> str; }; type User { property x -> str { default := (SELECT Note.remark LIMIT 1) } }; """, r""" type Note { required property note -> str; }; type User { property x -> str { default := (SELECT Note.note LIMIT 1) } }; """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_03(self): self._assert_migration_equivalence([r""" type Remark { required property note -> str; }; function foo(x: Remark) -> str using ( SELECT x.note ); """, r""" type Note { required property note -> str; }; function foo(x: Note) -> str using ( SELECT x.note ); """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_04(self): self._assert_migration_equivalence([r""" type Note { required property note -> str; index on (.note); }; """, r""" type Note { required property remark -> str; index on (.remark); }; """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_05(self): self._assert_migration_equivalence([r""" type Note { required property note -> str; property foo := .note ++ "!"; }; """, r""" type Remark { required property remark -> str; property foo := .remark ++ "!"; }; """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_06(self): self._assert_migration_equivalence([r""" type Note { required property note -> str; }; alias Alias1 := Note; alias Alias2 := (SELECT Note.note); alias Alias3 := Note { command := .note ++ "!" }; """, r""" type Remark { required property remark -> str; }; alias Alias1 := Remark; alias Alias2 := (SELECT Remark.remark); alias Alias3 := Remark { command := .remark ++ "!" }; """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_refs_07(self): self._assert_migration_equivalence([r""" type Obj1 { required property id1 -> str; required property id2 -> str; property exclusive_hack { using ((.id1, .id2)); constraint exclusive; }; } """, r""" type Obj2 { required property id1 -> str; required property id2 -> str; property exclusive_hack { using ((.id1, .id2)); constraint exclusive; }; } """])
, r
test_schema_migrations_equivalence_rename_refs_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_rename_alias_01(self): self._assert_migration_equivalence([r""" type Note { required property note -> str; }; alias Alias1 := Note; alias Alias2 := (SELECT Note.note); alias Alias3 := Note { command := .note ++ "!" }; alias Foo := Note { a := Alias1 }; """, r""" type Note { required property note -> str; }; alias Blias1 := Note; alias Blias2 := (SELECT Note.note); alias Blias3 := Note { command := .note ++ "!" }; alias Foo := Note { a := Blias1 }; """])
, r
test_schema_migrations_equivalence_rename_alias_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_rename_alias_02(self): self._assert_migration_equivalence([r""" type Note { required property note -> str; }; alias Alias2 := (SELECT Note.note); type Foo { multi property b -> str { default := (SELECT Alias2 LIMIT 1); } }; """, r""" type Note { required property note -> str; }; alias Blias2 := (SELECT Note.note); type Foo { multi property b -> str { default := (SELECT Blias2 LIMIT 1); } }; """])
, r
test_schema_migrations_equivalence_rename_alias_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_rename_annot_01(self): self._assert_migration_equivalence([r""" abstract annotation foo; type Object1 { annotation foo := 'bar'; }; """, r""" abstract annotation bar; type Object1 { annotation bar := 'bar'; }; """])
, r
test_schema_migrations_equivalence_rename_annot_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_rename_type_01(self): self._assert_migration_equivalence([r""" type Foo; type Baz { link a -> Foo; } """, r""" type Bar; type Baz { link a -> Bar; } """])
, r
test_schema_migrations_equivalence_rename_type_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_rename_type_02(self): self._assert_migration_equivalence([r""" type Note { property note -> str; } type Subtype extending Note; type Link { link a -> Note; } type Uses { required property x -> str { default := (SELECT Note.note LIMIT 1) } }; type ComputeLink { property foo -> str; multi link x := ( SELECT Note FILTER Note.note = ComputeLink.foo); }; alias Alias := Note; """, r""" type Remark { property note -> str; } type Subtype extending Remark; type Link { link a -> Remark; } type Uses { required property x -> str { default := (SELECT Remark.note LIMIT 1) } }; type ComputeLink { property foo -> str; multi link x := ( SELECT Remark FILTER Remark.note = ComputeLink.foo); }; alias Alias := Remark; """])
, r
test_schema_migrations_equivalence_rename_type_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_rename_type_03(self): self._assert_migration_equivalence([r""" type Note { property note -> str; } """, r""" type Remark { property note -> str; } type Subtype extending Remark; type Link { link a -> Remark; } type Uses { required property x -> str { default := (SELECT Remark.note LIMIT 1) } }; type ComputeLink { property foo -> str; multi link x := ( SELECT Remark FILTER Remark.note = ComputeLink.foo); }; alias Alias := Remark; """])
, r
test_schema_migrations_equivalence_rename_type_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_rename_enum_01(self): self._assert_migration_equivalence([r""" scalar type foo extending enum<'foo', 'bar'>; type Baz { property a -> foo; } """, r""" scalar type bar extending enum<'foo', 'bar'>; type Baz { property a -> bar; } """])
, r
test_schema_migrations_equivalence_rename_enum_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_rename_scalar_01(self): self._assert_migration_equivalence([r""" scalar type foo extending str; type Baz { property a -> foo; } """, r""" scalar type bar extending str; type Baz { property a -> bar; } """])
, r
test_schema_migrations_equivalence_rename_scalar_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_rename_abs_constraint_01(self): self._assert_migration_equivalence([r""" abstract constraint greater_or_equal(val: int64) { using (SELECT __subject__ >= val); }; type Note { required property note -> int64 { constraint greater_or_equal(10); } }; """, r""" abstract constraint not_less(val: int64) { using (SELECT __subject__ >= val); }; type Note { required property note -> int64 { constraint not_less(10); } }; """])
, r
test_schema_migrations_equivalence_rename_abs_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_rename_abs_ptr_01(self): self._assert_migration_equivalence([r""" abstract link abs_link { property prop -> int64; }; type LinkedObj; type RenameObj { multi link link EXTENDING abs_link -> LinkedObj; }; """, r""" abstract link new_abs_link { property prop -> int64; }; type LinkedObj; type RenameObj { multi link link EXTENDING new_abs_link -> LinkedObj; }; """])
, r
test_schema_migrations_equivalence_rename_abs_ptr_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_rename_abs_ptr_02(self): self._assert_migration_equivalence([r""" abstract property abs_prop { annotation title := "lol"; }; type RenameObj { property prop EXTENDING abs_prop -> str; }; """, r""" abstract property new_abs_prop { annotation title := "lol"; }; type RenameObj { property prop EXTENDING new_abs_prop -> str; }; """])
, r
test_schema_migrations_equivalence_rename_abs_ptr_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_deferred_index_01(self): self._assert_migration_equivalence([r""" abstract index test() { code := ' ((__col__) NULLS FIRST)'; deferrability := 'Permitted'; }; type Foo { property bar -> str; deferred index test on (.bar); }; """, r""" abstract index test() { code := ' ((__col__) NULLS FIRST)'; deferrability := 'Permitted'; }; type Foo { property bar -> str; index test on (.bar); }; """])
, r
test_schema_migrations_deferred_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_drop_parent_01(self): self._assert_migration_equivalence([r""" type Parent { property name -> str { constraint exclusive; } } type Child extending Parent { overloaded property name -> str; }; """, r""" type Parent { property name -> str { constraint exclusive; } } type Child { property name -> str; }; """])
, r
test_schema_migrations_drop_parent_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_drop_parent_02(self): self._assert_migration_equivalence([r""" type Parent { property name -> str { constraint exclusive; } } type Child extending Parent; """, r""" type Parent { property name -> str { constraint exclusive; } } type Child { property name -> str; } """])
, r
test_schema_migrations_drop_parent_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_drop_parent_03(self): self._assert_migration_equivalence([r""" type Parent { property name -> str { delegated constraint exclusive; } } type Child extending Parent; """, r""" type Parent { property name -> str { delegated constraint exclusive; } } type Child { property name -> str { constraint exclusive; } } """])
, r
test_schema_migrations_drop_parent_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_drop_parent_04(self): self._assert_migration_equivalence([r""" type Parent { link foo -> Object { property x -> str; } } type Child extending Parent; """, r""" type Parent { link foo -> Object { property x -> str; } } type Child { link foo -> Object { property x -> str; } } """])
, r
test_schema_migrations_drop_parent_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_drop_parent_05(self): self._assert_migration_equivalence([r""" type Parent { property x -> str; index on (.x); } type Child extending Parent; """, r""" type Parent { property x -> str; index on (.x); } type Child; """])
, r
test_schema_migrations_drop_parent_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_drop_parent_06(self): self._assert_migration_equivalence([r""" type Parent { property x -> str; constraint expression on (.x != "YOLO"); } type Child extending Parent; """, r""" type Parent { property x -> str; constraint expression on (.x != "YOLO"); } type Child; """])
, r
test_schema_migrations_drop_parent_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_drop_parent_07(self): self._assert_migration_equivalence([r""" type Parent { property x -> str; property z := .x ++ "!"; } type Child extending Parent; """, r""" type Parent { property x -> str; property z := .x ++ "!"; } type Child; """])
, r
test_schema_migrations_drop_parent_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_drop_owned_default_01(self): self._assert_migration_equivalence([ r""" type Foo; type Post { required property createdAt -> str { default := "asdf"; constraint expression on (__subject__ != "!"); } link whatever -> Foo { default := (SELECT Foo LIMIT 1); } } """, r""" type Foo; abstract type Event { required property createdAt -> str { default := "asdf"; constraint expression on (__subject__ != "!"); } link whatever -> Foo { default := (SELECT Foo LIMIT 1); } } type Post extending Event; """, r""" type Foo; type Post { required property createdAt -> str { default := "asdf"; constraint expression on (__subject__ != "!"); } link whatever -> Foo { default := (SELECT Foo LIMIT 1); } } """ ])
, r
test_schema_migrations_drop_owned_default_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_computed_optionality_01(self): self._assert_migration_equivalence([r""" abstract type Removable { optional single property removed := EXISTS( .<element[IS Tombstone] ); }; type Topic extending Removable { multi link defs := .<topic[IS Definition]; }; alias VisibleTopic := ( SELECT Topic { defs := ( SELECT .<topic[IS Definition] FILTER NOT .removed ), } FILTER NOT .removed ); type Definition extending Removable { required link topic -> Topic; }; type Tombstone { required link element -> Removable { constraint exclusive; } }; """, r""" abstract type Removable { property removed := EXISTS(.<element[IS Tombstone]); }; type Topic extending Removable { multi link defs := .<topic[IS Definition]; }; alias VisibleTopic := ( SELECT Topic { defs := ( SELECT .<topic[IS Definition] FILTER NOT .removed ), } FILTER NOT .removed ); type Definition extending Removable { required link topic -> Topic; }; type Tombstone { required link element -> Removable { constraint exclusive; } }; """])
, r
test_schema_migrations_computed_optionality_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_extend_enum_01(self): self._assert_migration_equivalence([r""" scalar type foo extending enum<Foo, Bar>; """, r""" scalar type foo extending enum<Foo, Bar, Baz>; """])
, r
test_schema_migrations_extend_enum_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_drop_depended_on_parent_01(self): self._assert_migration_equivalence([r""" type Person2 { required single property first -> str; } type Person2a extending Person2 { constraint exclusive on (__subject__.first); } """, r""" """])
, r
test_schema_migrations_drop_depended_on_parent_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_drop_depended_on_parent_02(self): self._assert_migration_equivalence([r""" type Person2; type Person2a extending Person2; """, r""" """])
, r
test_schema_migrations_drop_depended_on_parent_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_drop_depended_on_parent_03(self): self._assert_migration_equivalence([r""" type Person2 { required single property first -> str; }; type Person2a extending Person2; """, r""" type Person2a; """])
, r
test_schema_migrations_drop_depended_on_parent_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_drop_from_one_parent_01(self): self._assert_migration_equivalence([r""" abstract type Text { property x -> str { constraint exclusive } } abstract type Owned { property x -> str { constraint exclusive } } type Comment extending Text, Owned; """, r""" abstract type Text { } abstract type Owned { property x -> str { constraint exclusive } } type Comment extending Text, Owned; """])
, r
test_schema_migrations_drop_from_one_parent_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_drop_from_one_parent_02(self): self._assert_migration_equivalence([r""" abstract type Text { property x -> str { constraint exclusive } } abstract type Owned { property x -> str { constraint exclusive } } type Comment extending Text, Owned; """, r""" abstract type Text { property x -> str } abstract type Owned { property x -> str { constraint exclusive } } type Comment extending Text, Owned; """])
, r
test_schema_migrations_drop_from_one_parent_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_expression_ref_01(self): self._assert_migration_equivalence([ r""" type Article { required property deleted_a := ( EXISTS (.<element[IS DeletionRecord])); }; type Category { required property deleted_c := ( EXISTS (.<element[IS DeletionRecord])); }; type DeletionRecord { required link element -> (Article | Category) { on target delete delete source; constraint std::exclusive; }; }; """, r""" abstract type Removable { property deleted := EXISTS(.<element[IS DeletionRecord]); } type Article extending Removable; type Category extending Removable; type DeletionRecord { required link element -> Removable { on target delete delete source; constraint std::exclusive; }; }; """ ])
, r
test_schema_migrations_expression_ref_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_on_target_delete_01(self): self._assert_migration_equivalence([ r""" type User { multi link workspaces -> Workspace { property title -> str; on target delete allow; } } type Workspace { multi link users := .<workspaces[is User]; } """, r""" type User { multi link workspaces := .<users[is Workspace]; } type Workspace { multi link users -> User { property title -> str; on target delete allow; } } """ ])
, r
test_schema_migrations_on_target_delete_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_on_source_delete_01(self): self._assert_migration_equivalence([ r""" type User { multi link workspaces -> Workspace { property title -> str; on source delete delete target; } } type Workspace { multi link users := .<workspaces[is User]; } """, r""" type User { multi link workspaces -> Workspace { property title -> str; on source delete allow; } } type Workspace { multi link users := .<workspaces[is User]; } """, r""" type User { multi link workspaces -> Workspace { property title -> str; } } type Workspace { multi link users := .<workspaces[is User]; } """ ])
, r
test_schema_migrations_on_source_delete_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_rename_with_stuff_01(self): self._assert_migration_equivalence([ r""" type Base { property x -> str; property xbang := .x ++ "!"; } type NamedObject extending Base { required property foo -> str; } """, r""" type Base { property x -> str; property xbang := .x ++ "!"; } type ReNamedObject extending Base { required property foo -> str; } """ ])
, r
test_schema_migrations_rename_with_stuff_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_rename_with_stuff_02(self): self._assert_migration_equivalence([ r""" type Base { property x -> str; index on (.x); } type NamedObject extending Base { required property foo -> str; } """, r""" type Base { property x -> str; index on (.x); } type ReNamedObject extending Base { required property foo -> str; } """ ])
, r
test_schema_migrations_rename_with_stuff_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_rename_with_stuff_03(self): self._assert_migration_equivalence([ r""" type Base { property x -> str; property z -> str { constraint expression on (__subject__ != "lol"); }; } type NamedObject extending Base { required property foo -> str; } """, r""" type Base { property x -> str; property z -> str { constraint expression on (__subject__ != "lol"); }; } type ReNamedObject extending Base { required property foo -> str; } """ ])
, r
test_schema_migrations_rename_with_stuff_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_rename_with_stuff_04(self): self._assert_migration_equivalence([ r""" type Base { property x -> str; constraint expression on ((.x != "lol")); } type NamedObject extending Base { required property foo -> str; } """, r""" type Base { property x -> str; constraint expression on ((.x != "lol")); } type ReNamedObject extending Base { required property foo -> str; } """ ])
, r
test_schema_migrations_rename_with_stuff_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_rename_and_modify_01(self): self._assert_migration_equivalence([ r""" type Branch{ property branchURL: std::str { constraint max_len_value(500); constraint min_len_value(5); }; }; """, r""" type Branch{ property email: std::str { constraint max_len_value(50); constraint min_len_value(5); }; }; """ ])
, r
test_schema_migrations_rename_and_modify_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_rename_and_modify_02(self): self._assert_migration_equivalence([ r""" type X { obj: Object { foo: str; }; }; """, r""" type X { obj2: Object { bar: int64; }; }; """ ])
, r
test_schema_migrations_rename_and_modify_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_rename_and_modify_03(self): self._assert_migration_equivalence([ r""" type Branch{ property branchName: std::str { constraint min_len_value(0); constraint max_len_value(255); }; property branchCode: std::int64; property branchURL: std::str { constraint max_len_value(500); constraint regexp("url"); constraint min_len_value(5); }; }; """, r""" type Branch{ property branchName: std::str { constraint min_len_value(0); constraint max_len_value(255); }; property branchCode: std::int64; property phoneNumber: std::str { constraint min_len_value(5); constraint max_len_value(50); constraint regexp(r"phone"); }; property email: std::str { constraint min_len_value(5); constraint max_len_value(50); constraint regexp(r"email"); }; }; """ ])
, r
test_schema_migrations_rename_and_modify_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_rename_and_modify_04(self): self._assert_migration_equivalence([ r""" type Branch{ property branchName: std::str { constraint min_len_value(0); constraint max_len_value(255); }; property branchCode: std::int64; property branchURL: std::str { constraint max_len_value(500); constraint regexp("url"); constraint min_len_value(5); }; }; """, r""" type Branch2 { property branchName: std::str { constraint min_len_value(0); constraint max_len_value(255); }; property branchCode: std::int64; property phoneNumber: std::str { constraint min_len_value(5); constraint max_len_value(50); constraint regexp(r"phone"); }; property email: std::str { constraint min_len_value(5); constraint max_len_value(50); constraint regexp(r"email"); }; }; """ ])
, r
test_schema_migrations_rename_and_modify_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_except_01(self): self._assert_migration_equivalence([ r""" type ExceptTest { required property name -> str; property deleted -> bool; }; """, r""" type ExceptTest { required property name -> str; property deleted -> bool; constraint exclusive on (.name) except (.deleted); index on (.name) except (.deleted); }; """, ])
, r
test_schema_migrations_except_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_half_diamonds_00(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> G { constraint exclusive; } } abstract type C extending B { link y -> H { constraint exclusive; } } abstract type D; type E extending D; type F extending C, B, D; type G extending D, A { link x := assert_single(.<z[IS B]); } type H extending B, D, A { link w := assert_single(.<y[IS C]); } """, r""" """, ])
, r
test_schema_migrations_half_diamonds_00
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_half_diamonds_01(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> A; }; abstract type C extending B; abstract type D; type F extending C, B; """, r""" """, ])
, r
test_schema_migrations_half_diamonds_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_half_diamonds_02(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> A; }; abstract type C extending B; abstract type C2 extending B; abstract type D; type F extending C, C2, B; """, r""" """, ])
, r
test_schema_migrations_half_diamonds_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_half_diamonds_03(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> A; }; abstract type C extending B; abstract type C2 extending C; abstract type D; type F extending C2, C, B; """, r""" """, ])
, r
test_schema_migrations_half_diamonds_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_half_diamonds_04(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> A; }; abstract type C extending B; abstract type C2 extending C; abstract type D; type F extending C2, B; """, r""" """, ])
, r
test_schema_migrations_half_diamonds_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_half_diamonds_05(self): self._assert_migration_equivalence([ r""" abstract type A; abstract type B { link z -> A; }; abstract type C extending B; abstract type C2 extending C; abstract type D; type F extending C2, C, B; type F2 extending F, C2, C, B; """, r""" """, ])
, r
test_schema_migrations_half_diamonds_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_nested_module_01(self): self._assert_migration_equivalence([r""" module foo { module bar {} } """, r""" module foo { module bar { module baz {} } } """])
, r
test_schema_migrations_equivalence_nested_module_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_property_aliases(self): self._assert_migration_equivalence([ r""" abstract type NamedObject { required property name: std::str; }; type Person extending default::User; type User extending default::NamedObject { multi link fav_users := (.favorites[is default::User]); multi link favorites: default::NamedObject; }; """, r""" """, ])
, r
test_schema_migrations_property_aliases
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_rewrites_01(self): self._assert_migration_equivalence([ r""" type User { name: str { rewrite update, insert using (.name ++ "!") } }; """, r""" """, ])
, r
test_schema_migrations_rewrites_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_rewrites_02(self): self._assert_migration_equivalence([ r""" type User { property foo -> bool; property bar -> bool; }; """, r""" type User { property foo -> bool { rewrite insert using ( __specified__.bar and __specified__.baz ); }; property bar -> bool { rewrite insert using ( __specified__.foo and __specified__.baz ); }; property baz -> bool { rewrite insert using ( __specified__.foo and __specified__.bar ); }; }; """, r""" type User { property foo -> bool; property bar -> bool; property baz -> bool; }; """, r""" """, ])
, r
test_schema_migrations_rewrites_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_implicit_type_01(self): self._assert_migration_equivalence([ r""" abstract type Pinnable { property pinned := __source__ in <Pinnable>{}; } """, r""" abstract type Pinnable { property pinned := __source__ in <Pinnable>{}; } type Foo extending Pinnable {} """, ])
, r
test_schema_migrations_implicit_type_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_implicit_type_02(self): self._assert_migration_equivalence([ r""" abstract type Person { multi link friends : Person{ constraint expression on ( __subject__ != __subject__@source ); }; } """, r""" abstract type Person { multi link friends : Person{ constraint expression on ( __subject__ != __subject__@source ); }; } type Employee extending Person{ department: str; } """, ])
, r
test_schema_migrations_implicit_type_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_inh_ordering_01(self): self._assert_migration_equivalence([ r""" type Tag extending Named { index on (.name); constraint expression on (.name != ""); constraint max_value(10) on (.cnt); } abstract type Named { required property name -> str; required property cnt -> int64; index on (.name); constraint expression on (.name != ""); constraint max_value(10) on (.cnt); } """, r""" abstract type Named { required property name -> str; required property cnt -> int64; index on (.name); constraint expression on (.name != ""); constraint max_value(10) on (.cnt); } type Tag extending Named { index on (.name); constraint expression on (.name != ""); constraint max_value(10) on (.cnt); } """, ])
, r
test_schema_migrations_inh_ordering_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_alias_alter_01(self): self._assert_migration_equivalence([ r""" alias X := '0'; alias Y := X; alias Z := Y; """, r""" alias X := '1'; alias Y := X; alias Z := Y; """, ])
, r
test_schema_migrations_alias_alter_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_union_ptrs_01(self): self._assert_migration_equivalence([ r""" type A; type A_ extending A; type B; type C { # link of type and base type link foo -> A | A_; }; """, r""" type A; type A_ extending A; type B; type C { # link of type, base type, and other type link foo -> A | A_ | B; }; """, r""" type A; type A_ extending A; type B; type C { # remove link }; """, ]) schema = r''' ''' self._assert_migration_consistency(schema)
, r
test_schema_migrations_union_ptrs_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_describe_01(self): self._assert_describe( """ type Foo; abstract annotation anno; scalar type int_t extending int64 { annotation anno := 'ext int'; constraint max_value(15); } abstract link f { property p -> int_t { annotation anno := 'annotated link property'; constraint max_value(10); } } type Parent { multi property name -> str; } type Parent2 { link foo -> Foo; index on (.foo); } type Child extending Parent, Parent2 { annotation anno := 'annotated'; overloaded link foo extending f -> Foo { constraint exclusive { annotation anno := 'annotated constraint'; } annotation anno := 'annotated link'; } } """, 'DESCRIBE TYPE Child AS SDL', """ type test::Child extending test::Parent, test::Parent2 { annotation test::anno := 'annotated'; overloaded link foo: test::Foo { extending test::f; annotation test::anno := 'annotated link'; constraint std::exclusive { annotation test::anno := 'annotated constraint'; }; }; }; """, 'DESCRIBE TYPE Child AS TEXT VERBOSE', """ type test::Child extending test::Parent, test::Parent2 { annotation test::anno := 'annotated'; index on (.foo); required single link __type__: schema::ObjectType { readonly := true; }; overloaded single link foo: test::Foo { extending test::f; annotation test::anno := 'annotated link'; constraint std::exclusive { annotation test::anno := 'annotated constraint'; }; optional single property p: test::int_t { constraint std::max_value(10); }; }; required single property id: std::uuid { readonly := true; constraint std::exclusive; }; optional multi property name: std::str; }; """, 'DESCRIBE TYPE Child AS TEXT', """ type test::Child extending test::Parent, test::Parent2 { required single link __type__: schema::ObjectType { readonly := true; }; overloaded single link foo: test::Foo { extending test::f; optional single property p: test::int_t; }; required single property id: std::uuid { readonly := true; }; optional multi property name: std::str; }; """, 'DESCRIBE OBJECT int_t AS TEXT', """ scalar type test::int_t extending std::int64; """, 'DESCRIBE OBJECT int_t AS TEXT VERBOSE', """ scalar type test::int_t extending std::int64 { annotation test::anno := 'ext int'; constraint std::max_value(15); }; """, 'DESCRIBE OBJECT array_agg AS TEXT', """ function std::array_agg(s: SET OF anytype) -> array<anytype> { volatility := 'Immutable'; annotation std::description := 'Return the array made from all of the input set elements.'; using sql function 'array_agg'; }; """, 'DESCRIBE FUNCTION sys::get_version AS SDL', r""" function sys::get_version() -> tuple<major: std::int64, minor: std::int64, stage: sys::VersionStage, stage_no: std::int64, local: array<std::str>> { volatility := 'Stable'; annotation std::description := 'Return the server version as a tuple.'; using (SELECT <tuple< major: std::int64, minor: std::int64, stage: sys::VersionStage, stage_no: std::int64, local: array<std::str>>>sys::__version_internal() ) ;}; """, )
type Foo; abstract annotation anno; scalar type int_t extending int64 { annotation anno := 'ext int'; constraint max_value(15); } abstract link f { property p -> int_t { annotation anno := 'annotated link property'; constraint max_value(10); } } type Parent { multi property name -> str; } type Parent2 { link foo -> Foo; index on (.foo); } type Child extending Parent, Parent2 { annotation anno := 'annotated'; overloaded link foo extending f -> Foo { constraint exclusive { annotation anno := 'annotated constraint'; } annotation anno := 'annotated link'; } } """, 'DESCRIBE TYPE Child AS SDL',
test_schema_describe_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_describe_02(self): self._assert_describe( """ type Foo; type Bar; type Spam { link foobar -> Foo | Bar } """, 'DESCRIBE TYPE Spam AS SDL', # The order of components in UNION is not defined, # so we provide two possibilities of output. [ """ type test::Spam { link foobar: (test::Foo | test::Bar); }; """, """ type test::Spam { link foobar: (test::Bar | test::Foo); }; """, ] )
type Foo; type Bar; type Spam { link foobar -> Foo | Bar } """, 'DESCRIBE TYPE Spam AS SDL', # The order of components in UNION is not defined, # so we provide two possibilities of output. [
test_schema_describe_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_describe_03(self): self._assert_describe( """ scalar type custom_str_t extending str { constraint regexp('[A-Z]+'); } """, 'DESCRIBE MODULE test', """ CREATE SCALAR TYPE test::custom_str_t EXTENDING std::str { CREATE CONSTRAINT std::regexp('[A-Z]+'); }; """ )
scalar type custom_str_t extending str { constraint regexp('[A-Z]+'); } """, 'DESCRIBE MODULE test',
test_schema_describe_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_describe_04(self): self._assert_describe( """ abstract constraint my_one_of(one_of: array<anytype>) { using (contains(one_of, __subject__)); } """, 'DESCRIBE MODULE test', """ CREATE ABSTRACT CONSTRAINT test::my_one_of(one_of: array<anytype>){ USING (std::contains(one_of, __subject__)); }; """ )
abstract constraint my_one_of(one_of: array<anytype>) { using (contains(one_of, __subject__)); } """, 'DESCRIBE MODULE test',
test_schema_describe_04
python
geldata/gel
tests/test_schema.py
https://github.com/geldata/gel/blob/master/tests/test_schema.py
Apache-2.0