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 |
---|---|---|---|---|---|---|---|
async def test_sql_dml_delete_08(self):
[document] = await self.squery_values(
'INSERT INTO "Document" DEFAULT VALUES RETURNING id'
)
[user1] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
[user2] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
await self.scon.execute(
'''
INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
# delete where false
res = await self.scon.execute(
'''
DELETE FROM "Document.shared_with" WHERE FALSE
''',
)
self.assertEqual(res, 'DELETE 0')
res = await self.squery_values(
'''
SELECT COUNT(*) FROM "Document.shared_with"
''',
)
self.assertEqual(res, [[2]])
# delete where source
res = await self.scon.execute(
'''
DELETE FROM "Document.shared_with" WHERE source = $1
''',
document[0],
)
self.assertEqual(res, 'DELETE 2')
await self.scon.execute(
'''
INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
# delete where target
res = await self.scon.execute(
'''
DELETE FROM "Document.shared_with" WHERE target = $1
''',
user1[0],
)
self.assertEqual(res, 'DELETE 1')
await self.scon.execute(
'''
INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
# delete all
res = await self.scon.execute(
'''
DELETE FROM "Document.shared_with"
'''
)
self.assertEqual(res, 'DELETE 2') | INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
# delete where false
res = await self.scon.execute( | test_sql_dml_delete_08 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_09(self):
# delete with returning clause and using and CTEs
[document] = await self.squery_values(
'INSERT INTO "Document" DEFAULT VALUES RETURNING id'
)
[user1] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
[user2] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
await self.squery_values(
'''
INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
deleted = await self.squery_values(
'''
WITH
users_to_keep as (SELECT id FROM "User" WHERE id = $1),
users_to_delete as (
SELECT u.id
FROM "User" u
LEFT JOIN users_to_keep utk ON (u.id = utk.id)
WHERE utk.id IS NULL
)
DELETE FROM "Document.shared_with" dsw
USING users_to_delete utd
WHERE utd.id = dsw.target
RETURNING source, target
''',
user2[0],
)
self.assertEqual(deleted, [[document[0], user1[0]]]) | INSERT INTO "Document.shared_with" (source, target)
VALUES ($1, $2), ($1, $3)
''',
document[0],
user1[0],
user2[0],
)
deleted = await self.squery_values( | test_sql_dml_delete_09 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_10(self):
# delete from a single link table
[user1] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
[user2] = await self.squery_values(
'INSERT INTO "User" DEFAULT VALUES RETURNING id'
)
[doc1, _doc2] = await self.squery_values(
'''
INSERT INTO "Document" (owner_id) VALUES ($1), ($2) RETURNING id
''',
user1[0],
user2[0],
)
deleted = await self.squery_values(
'''
DELETE FROM "Document.owner"
WHERE source = $1
RETURNING source, target, is_author
''',
doc1[0],
)
self.assertEqual(deleted, [[doc1[0], user1[0], None]]) | INSERT INTO "Document" (owner_id) VALUES ($1), ($2) RETURNING id
''',
user1[0],
user2[0],
)
deleted = await self.squery_values( | test_sql_dml_delete_10 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_11(self):
# delete from a single link table
[document] = await self.squery_values(
'''
INSERT INTO "Document" (title) VALUES ('Report') RETURNING id
'''
)
await self.squery_values(
'''
INSERT INTO "Document.keywords"
VALUES ($1, 'notes'), ($1, 'priority')
''',
document[0],
)
deleted = await self.squery_values(
'''
DELETE FROM "Document.keywords"
WHERE target = 'priority'
RETURNING source, target
'''
)
self.assertEqual(deleted, [[document[0], 'priority']])
deleted = await self.squery_values(
'''
DELETE FROM "Document.keywords"
WHERE source = $1
RETURNING source, target
''',
document[0],
)
self.assertEqual(deleted, [[document[0], 'notes']]) | INSERT INTO "Document" (title) VALUES ('Report') RETURNING id | test_sql_dml_delete_11 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_12(self):
# Create a new document and try to delete it immediately.
# This will not delete the document, since DELETE statement cannot "see"
# the document that has just been inserted (this is Postgres behavior).
res = await self.scon.execute(
'''
WITH inserted as (
INSERT INTO "Document" (title) VALUES ('Report') RETURNING id
)
DELETE FROM "Document" d USING inserted WHERE d.id = inserted.id
'''
)
self.assertEqual(res, 'DELETE 0')
res = await self.squery_values(
'SELECT COUNT(*) FROM "Document"',
)
self.assertEqual(res, [[1]]) | WITH inserted as (
INSERT INTO "Document" (title) VALUES ('Report') RETURNING id
)
DELETE FROM "Document" d USING inserted WHERE d.id = inserted.id | test_sql_dml_delete_12 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_13(self):
[[doc_id, user_id]] = await self.squery_values(
'''
WITH
d AS (INSERT INTO "Document" DEFAULT VALUES RETURNING id),
u AS (INSERT INTO "User" DEFAULT VALUES RETURNING id)
INSERT INTO "Document.shared_with" (source, target)
VALUES ((SELECT id FROM d), (SELECT id FROM u))
RETURNING source, target
'''
)
res = await self.scon.execute(
'''
WITH
inserted(s, t) AS (VALUES ($1::uuid, $2::uuid))
DELETE FROM "Document.shared_with" dsw
USING inserted
WHERE dsw.source = inserted.s AND dsw.target = inserted.t
''',
doc_id,
user_id,
)
self.assertEqual(res, 'DELETE 1') | WITH
d AS (INSERT INTO "Document" DEFAULT VALUES RETURNING id),
u AS (INSERT INTO "User" DEFAULT VALUES RETURNING id)
INSERT INTO "Document.shared_with" (source, target)
VALUES ((SELECT id FROM d), (SELECT id FROM u))
RETURNING source, target | test_sql_dml_delete_13 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_delete_14(self):
# Test that RETURNING supports "Table".col format
await self.scon.execute(
'''
INSERT INTO "Document" (title)
VALUES ('Test returning')
'''
)
res = await self.squery_values(
'''
DELETE FROM "Document"
WHERE title LIKE 'Test returning%'
RETURNING "Document".title
''',
)
self.assertEqual(res, [['Test returning (new)']]) | INSERT INTO "Document" (title)
VALUES ('Test returning') | test_sql_dml_delete_14 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_01(self):
# update, inspect CommandComplete tag
await self.scon.execute(
'''
INSERT INTO "Document" (title)
VALUES ('Report'), ('Report'), ('Briefing')
'''
)
res = await self.scon.execute(
'''
UPDATE "Document"
SET title = '[REDACTED]'
WHERE title LIKE 'Report%'
''',
)
self.assertEqual(res, 'UPDATE 2')
res = await self.squery_values(
'''
SELECT title FROM "Document" ORDER BY title
''',
)
self.assertEqual(
res,
[
['Briefing (new)'],
['[REDACTED] (updated)'],
['[REDACTED] (updated)'],
],
) | INSERT INTO "Document" (title)
VALUES ('Report'), ('Report'), ('Briefing') | test_sql_dml_update_01 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_02(self):
# update with returning clause, inspect CommandComplete tag
await self.scon.execute(
'''
INSERT INTO "Document" (title)
VALUES ('Report'), ('Report'), ('Briefing')
'''
)
res = await self.scon.execute(
'''
UPDATE "Document"
SET title = '[REDACTED]'
WHERE title LIKE 'Report%'
RETURNING id
''',
)
self.assertEqual(res, 'UPDATE 2') | INSERT INTO "Document" (title)
VALUES ('Report'), ('Report'), ('Briefing') | test_sql_dml_update_02 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_03(self):
# update with returning clause
await self.scon.execute(
'''
INSERT INTO "Document" (title) VALUES ('Report'), ('Briefing')
'''
)
res = await self.squery_values(
'''
UPDATE "Document" SET title = title RETURNING title
''',
)
self.assertEqual(
res, [['Report (new) (updated)'], ['Briefing (new) (updated)']]
) | INSERT INTO "Document" (title) VALUES ('Report'), ('Briefing') | test_sql_dml_update_03 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_04(self):
# update with from clause
users = await self.squery_values(
'''
INSERT INTO "User" (id) VALUES (DEFAULT), (DEFAULT) RETURNING id
'''
)
await self.squery_values(
'''
WITH u(id) as (VALUES ($1), ($2))
INSERT INTO "Document" (title, owner_id)
SELECT 'Report', u.id FROM u
RETURNING title, owner_id
''',
str(users[0][0]),
str(users[1][0]),
)
res = await self.squery_values(
'''
UPDATE "Document"
SET owner_id = owner_id
FROM "User" u
WHERE "Document".owner_id = u.id AND title = 'Report (new)'
RETURNING title, owner_id
''',
)
self.assertEqual(
res,
[
['Report (new) (updated)', res[0][1]],
['Report (new) (updated)', res[1][1]],
],
) | INSERT INTO "User" (id) VALUES (DEFAULT), (DEFAULT) RETURNING id | test_sql_dml_update_04 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_06(self):
# update returning *
await self.scon.execute(
'''
INSERT INTO "Document" (title) VALUES ('Report')
'''
)
res = await self.squery_values(
'''
UPDATE "Document" SET owner_id = NULL RETURNING *
''',
)
self.assertIsInstance(res[0][0], uuid.UUID)
self.assertIsInstance(res[0][1], uuid.UUID)
self.assertEqual(
res, [[res[0][0], res[0][1], None, 'Report (new) (updated)']]
) | INSERT INTO "Document" (title) VALUES ('Report') | test_sql_dml_update_06 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_07(self):
# update with CTEs
await self.scon.execute(
'''
INSERT INTO "User" DEFAULT VALUES
'''
)
await self.scon.execute(
'''
INSERT INTO "Document" (title, owner_id)
VALUES
('Report', NULL),
('Briefing', (SELECT id FROM "User" LIMIT 1))
'''
)
res = await self.squery_values(
'''
WITH
users as (SELECT id FROM "User"),
not_owned as (
SELECT d.id
FROM "Document" d
LEFT JOIN users u ON d.owner_id = u.id
WHERE u.id IS NULL
)
UPDATE "Document"
SET title = title
FROM not_owned
WHERE not_owned.id = "Document".id
RETURNING title
''',
)
self.assertEqual(res, [['Report (new) (updated)']]) | INSERT INTO "User" DEFAULT VALUES | test_sql_dml_update_07 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_08(self):
# update with a trivial multi-ref
[user] = await self.squery_values(
'''
INSERT INTO "User" DEFAULT VALUES RETURNING id
'''
)
await self.scon.execute(
'''
INSERT INTO "Document" (title, owner_id)
VALUES (NULL, NULL)
'''
)
res = await self.squery_values(
'''
UPDATE "Document"
SET (title, owner_id) = ROW('hello', $1::uuid)
RETURNING title, owner_id
''',
user[0],
)
self.assertEqual(res, [['hello (updated)', user[0]]]) | INSERT INTO "User" DEFAULT VALUES RETURNING id | test_sql_dml_update_08 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_10(self):
# update set link id to uuid
[user] = await self.squery_values(
'''
INSERT INTO "User" DEFAULT VALUES RETURNING id
'''
)
await self.scon.execute(
'''
INSERT INTO "Document" DEFAULT VALUES
'''
)
res = await self.squery_values(
'''
UPDATE "Document" SET owner_id = $1 RETURNING owner_id
''',
user[0],
)
self.assertEqual(res, [[user[0]]]) | INSERT INTO "User" DEFAULT VALUES RETURNING id | test_sql_dml_update_10 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_11(self):
# update set default
res = await self.squery_values(
'''
INSERT INTO "Post" (title, created_at)
VALUES (DEFAULT, DEFAULT)
RETURNING title, created_at
'''
)
self.assertEqual(res, [['untitled', None]])
res = await self.squery_values(
'''
UPDATE "Post" SET
title = 'Announcing EdgeDB 1.0',
created_at = '2024-08-08T08:08:08.000'::timestamp
RETURNING title, created_at::text
'''
)
self.assertEqual(
res, [['Announcing EdgeDB 1.0', '2024-08-08 08:08:08+00']]
)
res = await self.squery_values(
'''
UPDATE "Post" SET
title = DEFAULT,
created_at = DEFAULT
RETURNING title, created_at
'''
)
self.assertEqual(res, [['untitled', None]]) | INSERT INTO "Post" (title, created_at)
VALUES (DEFAULT, DEFAULT)
RETURNING title, created_at | test_sql_dml_update_11 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_13(self):
with self.assertRaisesRegex(
asyncpg.FeatureNotSupportedError,
'UPDATE of link tables is not supported',
):
await self.squery_values(
'''
UPDATE "Document.shared_with" SET can_edit = FALSE
'''
) | UPDATE "Document.shared_with" SET can_edit = FALSE | test_sql_dml_update_13 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_14(self):
# UPDATE will not match anything, because the inserted document is not
# yet "visible" during the UPDATE statement (this is Postgres behavior).
res = await self.scon.execute(
'''
WITH inserted as (
INSERT INTO "Document" (title) VALUES ('Report') RETURNING id
)
UPDATE "Document" d
SET title = 'Briefing'
FROM inserted
WHERE d.id = inserted.id
'''
)
self.assertEqual(res, 'UPDATE 0')
res = await self.squery_values(
'SELECT title FROM "Document" ORDER BY title',
)
self.assertEqual(res, [['Report (new)']])
# Now we remove UPDATE condition and expect all documents that existed
# *before* this statement to be updated.
res = await self.scon.execute(
'''
WITH inserted as (
INSERT INTO "Document" (title) VALUES ('Receipt') RETURNING id
)
UPDATE "Document" d
SET title = 'Briefing'
'''
)
self.assertEqual(res, 'UPDATE 1')
res = await self.squery_values(
'SELECT title FROM "Document" ORDER BY title',
)
self.assertEqual(res, [['Briefing (updated)'], ['Receipt (new)']]) | WITH inserted as (
INSERT INTO "Document" (title) VALUES ('Report') RETURNING id
)
UPDATE "Document" d
SET title = 'Briefing'
FROM inserted
WHERE d.id = inserted.id | test_sql_dml_update_14 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_14a(self):
await self.squery_values(
'INSERT INTO "Document" DEFAULT VALUES',
)
res = await self.scon.execute(
'''
WITH
u AS (INSERT INTO "User" DEFAULT VALUES RETURNING id)
UPDATE "Document" SET owner_id = (SELECT id FROM u)
'''
)
self.assertEqual(res, 'UPDATE 1')
res = await self.squery_values(
'SELECT owner_id IS NULL FROM "Document"',
)
self.assertEqual(res, [[False]]) | WITH
u AS (INSERT INTO "User" DEFAULT VALUES RETURNING id)
UPDATE "Document" SET owner_id = (SELECT id FROM u) | test_sql_dml_update_14a | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_15(self):
[[doc_id]] = await self.squery_values(
'''
INSERT INTO "Document" (title) VALUES ('Briefing') RETURNING id
'''
)
res = await self.scon.execute(
'''
WITH updated as (
UPDATE "Document" d
SET title = 'Report'
WHERE d.id = $1
RETURNING id, title
)
INSERT INTO "Document" (title)
SELECT 'X' || id::uuid || ',' || title FROM updated
''',
doc_id,
)
self.assertEqual(res, 'INSERT 0 1')
res = await self.squery_values(
'SELECT id, title FROM "Document" ORDER BY title',
)
self.assertEqual(len(res), 2)
existing_id, existing_title = res[0]
_inserted_id, inserted_title = res[1]
self.assertEqual(existing_title, 'Report (updated)')
self.assertEqual(
inserted_title,
'X' + str(existing_id) + ',' + existing_title + ' (new)',
) | INSERT INTO "Document" (title) VALUES ('Briefing') RETURNING id | test_sql_dml_update_15 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_16(self):
[[doc_id]] = await self.squery_values(
'INSERT INTO "Document" DEFAULT VALUES RETURNING id'
)
res = await self.squery_values(
'''
WITH
u1 as (
INSERT INTO "User" DEFAULT VALUES RETURNING id
)
UPDATE "Document" SET owner_id = u1.id
FROM u1
RETURNING id, owner_id
'''
)
user_id = res[0][1]
self.assertEqual(
res,
[
[doc_id, user_id],
],
)
res = await self.squery_values(
'''
SELECT id, owner_id FROM "Document"
'''
)
self.assertEqual(
res,
[
[doc_id, user_id],
],
) | WITH
u1 as (
INSERT INTO "User" DEFAULT VALUES RETURNING id
)
UPDATE "Document" SET owner_id = u1.id
FROM u1
RETURNING id, owner_id | test_sql_dml_update_16 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_update_17(self):
# Test that RETURNING supports "Table".col format
await self.scon.execute(
'''
INSERT INTO "Document" (title)
VALUES ('Report')
'''
)
res = await self.squery_values(
'''
UPDATE "Document"
SET title = 'Test returning'
WHERE title LIKE 'Report%'
RETURNING "Document".title
''',
)
self.assertEqual(res, [['Test returning (updated)']]) | INSERT INTO "Document" (title)
VALUES ('Report') | test_sql_dml_update_17 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_01(self):
# update/delete only
await self.scon.execute(
'''
INSERT INTO "Base" (prop) VALUES ('base')
'''
)
await self.scon.execute(
'''
INSERT INTO "Child" (prop) VALUES ('child')
'''
)
res = await self.squery_values('SELECT prop FROM "Base" ORDER BY prop')
self.assertEqual(res, [['base'], ['child']])
res = await self.squery_values('SELECT prop FROM ONLY "Base"')
self.assertEqual(res, [['base']])
res = await self.squery_values('SELECT prop FROM "Child"')
self.assertEqual(res, [['child']])
await self.scon.execute(
'''
UPDATE ONLY "Base" SET prop = 'a'
'''
)
res = await self.squery_values('SELECT prop FROM "Base" ORDER BY prop')
self.assertEqual(res, [['a'], ['child']])
await self.scon.execute(
'''
DELETE FROM ONLY "Base"
'''
)
res = await self.squery_values('SELECT prop FROM "Base" ORDER BY prop')
self.assertEqual(res, [['child']]) | INSERT INTO "Base" (prop) VALUES ('base') | test_sql_dml_01 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
async def test_sql_dml_02(self):
# globals
await self.scon.execute(
'''
INSERT INTO "Globals" DEFAULT VALUES
'''
)
await self.scon.execute(
"""
SET LOCAL "global default::y" TO 'Hello world!';
"""
)
await self.scon.execute(
'''
INSERT INTO "Globals" DEFAULT VALUES
'''
)
res = await self.squery_values('SELECT gy FROM "Globals" ORDER BY gy')
self.assertEqual(res, [['Hello world!'], [None]]) | INSERT INTO "Globals" DEFAULT VALUES | test_sql_dml_02 | python | geldata/gel | tests/test_sql_dml.py | https://github.com/geldata/gel/blob/master/tests/test_sql_dml.py | Apache-2.0 |
def test_schema_overloaded_prop_01(self):
"""
type UniqueName {
property name -> str {
constraint exclusive
}
};
type UniqueName_2 extending UniqueName {
overloaded property name -> str {
constraint exclusive
}
};
""" | type UniqueName {
property name -> str {
constraint exclusive
}
};
type UniqueName_2 extending UniqueName {
overloaded property name -> str {
constraint exclusive
}
}; | test_schema_overloaded_prop_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_overloaded_prop_02(self):
"""
type UniqueName {
property name -> str {
constraint exclusive
}
};
type UniqueName_2 extending UniqueName {
property name -> str {
constraint exclusive
}
};
""" | type UniqueName {
property name -> str {
constraint exclusive
}
};
type UniqueName_2 extending UniqueName {
property name -> str {
constraint exclusive
}
}; | test_schema_overloaded_prop_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_overloaded_prop_03(self):
"""
type UniqueName {
overloaded property name -> str
};
""" | type UniqueName {
overloaded property name -> str
}; | test_schema_overloaded_prop_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_overloaded_prop_04(self):
"""
type UniqueName {
property val -> str {
constraint exclusive;
}
};
type UniqueName_2 extending UniqueName {
overloaded property val -> str {
using ('bad');
}
};
""" | type UniqueName {
property val -> str {
constraint exclusive;
}
};
type UniqueName_2 extending UniqueName {
overloaded property val -> str {
using ('bad');
}
}; | test_schema_overloaded_prop_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_overloaded_prop_05(self):
"""
type UniqueName {
property val := 'ok';
};
type UniqueName_2 extending UniqueName {
# This doesn't appear to be a computable property, but
# it is due to inheritance.
overloaded property val -> str {
constraint exclusive;
}
};
""" | type UniqueName {
property val := 'ok';
};
type UniqueName_2 extending UniqueName {
# This doesn't appear to be a computable property, but
# it is due to inheritance.
overloaded property val -> str {
constraint exclusive;
}
}; | test_schema_overloaded_prop_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_overloaded_prop_06(self):
"""
type UniqueName {
property val := 'ok';
};
type UniqueName_2 {
property val -> str;
};
type UniqueName_3 extending UniqueName, UniqueName_2;
""" | type UniqueName {
property val := 'ok';
};
type UniqueName_2 {
property val -> str;
};
type UniqueName_3 extending UniqueName, UniqueName_2; | test_schema_overloaded_prop_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_overloaded_prop_07(self):
"""
type UniqueName {
property val := 'ok';
};
type UniqueName_2 {
property val := 'ok';
};
# It's illegal to extend 2 computable properties even if
# the expression is the same for them.
type UniqueName_3 extending UniqueName, UniqueName_2;
""" | type UniqueName {
property val := 'ok';
};
type UniqueName_2 {
property val := 'ok';
};
# It's illegal to extend 2 computable properties even if
# the expression is the same for them.
type UniqueName_3 extending UniqueName, UniqueName_2; | test_schema_overloaded_prop_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_overloaded_prop_08(self):
"""
type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
type UniqueName_3 extending UniqueName_2;
type UniqueName_4 extending UniqueName, UniqueName_3;
""" | type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
type UniqueName_3 extending UniqueName_2;
type UniqueName_4 extending UniqueName, UniqueName_3; | test_schema_overloaded_prop_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_overloaded_prop_09(self):
# Overloading implicitly via a type UNION.
"""
type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
alias Combo := {UniqueName, UniqueName_2};
""" | type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
alias Combo := {UniqueName, UniqueName_2}; | test_schema_overloaded_prop_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_overloaded_prop_10(self):
# Overloading implicitly via a type UNION.
"""
type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
type Combo {
multi link comp := {UniqueName, UniqueName_2};
}
""" | type UniqueName {
property val -> str;
};
type UniqueName_2 {
property val := 'ok';
};
type Combo {
multi link comp := {UniqueName, UniqueName_2};
} | test_schema_overloaded_prop_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_overloaded_prop_11(self):
"""
type UniqueName {
property name -> str;
};
type UniqueName_2 extending UniqueName {
overloaded property name -> bytes;
};
""" | type UniqueName {
property name -> str;
};
type UniqueName_2 extending UniqueName {
overloaded property name -> bytes;
}; | test_schema_overloaded_prop_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_overloaded_link_01(self):
"""
type Foo;
type UniqueName {
link foo -> Foo;
};
type UniqueName_2 extending UniqueName {
overloaded link foo -> Foo {
using (SELECT Foo LIMIT 1);
}
};
""" | type Foo;
type UniqueName {
link foo -> Foo;
};
type UniqueName_2 extending UniqueName {
overloaded link foo -> Foo {
using (SELECT Foo LIMIT 1);
}
}; | test_schema_overloaded_link_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_overloaded_link_02(self):
"""
type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 extending UniqueName {
# This doesn't appear to be a computable link, but
# it is due to inheritance.
overloaded link foo -> Foo {
constraint exclusive;
}
};
""" | type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 extending UniqueName {
# This doesn't appear to be a computable link, but
# it is due to inheritance.
overloaded link foo -> Foo {
constraint exclusive;
}
}; | test_schema_overloaded_link_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_overloaded_link_03(self):
"""
type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 {
link foo -> Foo;
};
type UniqueName_3 extending UniqueName, UniqueName_2;
""" | type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 {
link foo -> Foo;
};
type UniqueName_3 extending UniqueName, UniqueName_2; | test_schema_overloaded_link_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_overloaded_link_04(self):
"""
type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 {
link foo := (SELECT Foo LIMIT 1);
};
# It's illegal to extend 2 computable links even if
# the expression is the same for them.
type UniqueName_3 extending UniqueName, UniqueName_2;
""" | type Foo;
type UniqueName {
link foo := (SELECT Foo LIMIT 1);
};
type UniqueName_2 {
link foo := (SELECT Foo LIMIT 1);
};
# It's illegal to extend 2 computable links even if
# the expression is the same for them.
type UniqueName_3 extending UniqueName, UniqueName_2; | test_schema_overloaded_link_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_index_computed_01(self):
"""
type SignatureStatus {
required property signature -> str;
link memo := (
select Memo filter .signature = SignatureStatus.signature limit 1);
index on (.memo);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
}
""" | type SignatureStatus {
required property signature -> str;
link memo := (
select Memo filter .signature = SignatureStatus.signature limit 1);
index on (.memo);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
} | test_schema_index_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_index_computed_02(self):
"""
type SignatureStatus {
required property signature -> str;
link memo := (
select Memo filter .signature = SignatureStatus.signature limit 1);
index on (__subject__ { lol := .memo }.lol);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
}
""" | type SignatureStatus {
required property signature -> str;
link memo := (
select Memo filter .signature = SignatureStatus.signature limit 1);
index on (__subject__ { lol := .memo }.lol);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
} | test_schema_index_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_index_computed_03(self):
"""
type SignatureStatus {
required property signature -> str;
link memo_: Memo;
link memo := .memo_;
index on (.memo);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
}
""" | type SignatureStatus {
required property signature -> str;
link memo_: Memo;
link memo := .memo_;
index on (.memo);
}
type Memo {
required property signature -> str {
constraint exclusive;
}
} | test_schema_index_computed_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_bad_link_01(self):
"""
type Object {
link foo -> str
};
""" | type Object {
link foo -> str
}; | test_schema_bad_link_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_bad_link_02(self):
"""
type Object {
link foo := 1 + 1
};
""" | type Object {
link foo := 1 + 1
}; | test_schema_bad_link_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_bad_link_03(self):
"""
type Object {
link foo -> FreeObject
};
""" | type Object {
link foo -> FreeObject
}; | test_schema_bad_link_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_bad_link_04(self):
"""
type Object {
property foo -> str;
link bar := .foo;
};
""" | type Object {
property foo -> str;
link bar := .foo;
}; | test_schema_bad_link_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_bad_link_05(self):
"""
type A;
type Foo {
required link foo -> A {
on target delete deferred restrict;
}
};
""" | type A;
type Foo {
required link foo -> A {
on target delete deferred restrict;
}
}; | test_schema_bad_link_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_bad_link_06(self):
"""
abstract link abs { property foo: str };
type T { multi link following extending abs -> T {using (T)} }
""" | abstract link abs { property foo: str };
type T { multi link following extending abs -> T {using (T)} } | test_schema_bad_link_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_link_prop_on_prop_01(self):
"""
type Test1 {
title : str {
sub_title : str
}
};
""" | type Test1 {
title : str {
sub_title : str
}
}; | test_schema_link_prop_on_prop_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_deletion_policy_on_prop_01(self):
"""
type Test1 {
title : str {
on source delete allow;
}
};
""" | type Test1 {
title : str {
on source delete allow;
}
}; | test_schema_deletion_policy_on_prop_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_deletion_policy_on_prop_02(self):
"""
type Test1 {
title : str {
on target delete restrict;
}
};
""" | type Test1 {
title : str {
on target delete restrict;
}
}; | test_schema_deletion_policy_on_prop_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_partial_path_in_default_of_link_prop_01(self):
"""
module default {
type Person {
required name: str {
constraint exclusive;
}
multi friends : Person {
note: str {
default := .name
}
}
}
}
""" | module default {
type Person {
required name: str {
constraint exclusive;
}
multi friends : Person {
note: str {
default := .name
}
}
}
} | test_schema_partial_path_in_default_of_link_prop_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_partial_path_in_trigger_01(self):
"""
type Foo {
property wow: bool;
trigger prohibit_queue after insert for each do (
select assert(.wow, message := "wow!")
);
}
""" | type Foo {
property wow: bool;
trigger prohibit_queue after insert for each do (
select assert(.wow, message := "wow!")
);
} | test_schema_partial_path_in_trigger_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_bad_prop_01(self):
"""
type Object {
property foo -> Object
};
""" | type Object {
property foo -> Object
}; | test_schema_bad_prop_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_bad_prop_02(self):
"""
type Object {
property foo := (SELECT Object)
};
""" | type Object {
property foo := (SELECT Object)
}; | test_schema_bad_prop_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_bad_prop_04(self):
"""
abstract property foo extending bar;
""" | abstract property foo extending bar; | test_schema_bad_prop_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_bad_prop_05(self):
"""
abstract link foo extending bar;
""" | abstract link foo extending bar; | test_schema_bad_prop_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_bad_prop_06(self):
"""
abstract link foo extending foo;
""" | abstract link foo extending foo; | test_schema_bad_prop_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_bad_prop_07(self):
"""
type Person {
required property name := str {
# empty block
}
}
""" | type Person {
required property name := str {
# empty block
}
} | test_schema_bad_prop_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_bad_type_01(self):
"""
type Object {
property foo -> int
};
""" | type Object {
property foo -> int
}; | test_schema_bad_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_bad_type_02(self):
"""
type Foo;
type Base {
property foo -> array<Foo>;
}
""" | type Foo;
type Base {
property foo -> array<Foo>;
} | test_schema_bad_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_bad_type_03(self):
"""
type Foo;
type Base {
property foo -> tuple<Foo>;
}
""" | type Foo;
type Base {
property foo -> tuple<Foo>;
} | test_schema_bad_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_bad_type_04(self):
"""
type Foo;
type Base {
property foo -> tuple<str, array<Foo>>;
}
""" | type Foo;
type Base {
property foo -> tuple<str, array<Foo>>;
} | test_schema_bad_type_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_bad_type_05(self):
"""
type Foo extending Bar;
""" | type Foo extending Bar; | test_schema_bad_type_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_bad_type_06(self):
"""
type Foo {
link val -> Bar;
};
""" | type Foo {
link val -> Bar;
}; | test_schema_bad_type_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_bad_type_07(self):
"""
type Foo {
annotation bar := 'Bogus';
};
""" | type Foo {
annotation bar := 'Bogus';
}; | test_schema_bad_type_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_bad_type_08(self):
"""
type Foo {
property val -> str {
constraint bogus(5);
}
};
""" | type Foo {
property val -> str {
constraint bogus(5);
}
}; | test_schema_bad_type_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_bad_type_09(self):
"""
type Foo extending Foo;
""" | type Foo extending Foo; | test_schema_bad_type_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_bad_type_10(self):
"""
type Foo0 extending Foo1;
type Foo1 extending Foo2;
type Foo2 extending Foo3;
type Foo3 extending Foo0;
""" | type Foo0 extending Foo1;
type Foo1 extending Foo2;
type Foo2 extending Foo3;
type Foo3 extending Foo0; | test_schema_bad_type_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_bad_type_11(self):
"""
type Foo;
type Bar;
type Spam {
multi link foobar := Foo[IS Bar];
}
""" | type Foo;
type Bar;
type Spam {
multi link foobar := Foo[IS Bar];
} | test_schema_bad_type_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_bad_type_12(self):
"""
type Foo {
property val -> anytype;
}
""" | type Foo {
property val -> anytype;
} | test_schema_bad_type_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_bad_type_13(self):
"""
type Foo {
link val -> anytype;
}
""" | type Foo {
link val -> anytype;
} | test_schema_bad_type_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_bad_type_14(self):
"""
type Foo {
property val -> anytuple;
}
""" | type Foo {
property val -> anytuple;
} | test_schema_bad_type_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_bad_type_15(self):
"""
scalar type Foo;
""" | scalar type Foo; | test_schema_bad_type_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_bad_type_16(self):
"""
type Foo {
property val -> str;
index on (.val);
index on (.val);
};
""" | type Foo {
property val -> str;
index on (.val);
index on (.val);
}; | test_schema_bad_type_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_bad_type_17a(self):
"""
type Foo {
property val -> str;
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.ita)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
};
""" | type Foo {
property val -> str;
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.ita)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
}; | test_schema_bad_type_17a | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_bad_type_17b(self):
"""
type Foo {
property val -> str;
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.ita)
);
};
""" | type Foo {
property val -> str;
index fts::index on (
fts::with_options(.val, language := fts::Language.eng)
);
index fts::index on (
fts::with_options(.val, language := fts::Language.ita)
);
}; | test_schema_bad_type_17b | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_bad_type_18(self):
"""
type Foo {
property val -> enum<VariantA, VariantB>;
};
""" | type Foo {
property val -> enum<VariantA, VariantB>;
}; | test_schema_bad_type_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_bad_type_19a(self):
"""
function foo() -> Bar using (1);
""" | function foo() -> Bar using (1); | test_schema_bad_type_19a | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_bad_type_19b(self):
"""
function foo(x: Bar) -> int64 using (1);
""" | function foo(x: Bar) -> int64 using (1); | test_schema_bad_type_19b | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_bad_type_19c(self):
"""
type Bar;
function foo() -> Bar | Baz using (1);
""" | type Bar;
function foo() -> Bar | Baz using (1); | test_schema_bad_type_19c | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_bad_type_19d(self):
"""
type Bar;
function foo(x: Bar | Baz) -> int64 using (1);
""" | type Bar;
function foo(x: Bar | Baz) -> int64 using (1); | test_schema_bad_type_19d | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
def test_schema_computable_cardinality_inference_03(self):
"""
type Spam {
required property title -> str;
multi link spams -> Spam;
single link ham := .spams;
}
""" | type Spam {
required property title -> str;
multi link spams -> Spam;
single link ham := .spams;
} | test_schema_computable_cardinality_inference_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_computable_cardinality_inference_04(self):
"""
type Spam {
required property title -> str;
multi link spams -> Spam;
single property hams := .spams.title;
}
""" | type Spam {
required property title -> str;
multi link spams -> Spam;
single property hams := .spams.title;
} | test_schema_computable_cardinality_inference_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_computable_cardinality_inference_05(self):
"""
type Spam {
required property title -> str;
multi link spams -> Spam;
required property hams := .spams.title;
}
""" | type Spam {
required property title -> str;
multi link spams -> Spam;
required property hams := .spams.title;
} | test_schema_computable_cardinality_inference_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_optionality_consistency_check_01(self):
"""
type A {
required property title -> str;
}
type B extending A {
overloaded optional property title -> str;
}
""" | type A {
required property title -> str;
}
type B extending A {
overloaded optional property title -> str;
} | test_schema_optionality_consistency_check_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_optionality_consistency_check_02(self):
"""
type A {
optional property title -> str;
}
type B {
required property title -> str;
}
type C extending A, B {
overloaded optional property title -> str;
}
""" | type A {
optional property title -> str;
}
type B {
required property title -> str;
}
type C extending A, B {
overloaded optional property title -> str;
} | test_schema_optionality_consistency_check_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_target_consistency_check_01(self):
"""
type A {
property title -> str {
using (1)
}
}
""" | type A {
property title -> str {
using (1)
}
} | test_schema_target_consistency_check_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_target_consistency_check_02(self):
"""
type A {
property title -> tuple<str, str> {
using ((1, 2))
}
}
""" | type A {
property title -> tuple<str, str> {
using ((1, 2))
}
} | test_schema_target_consistency_check_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_target_consistency_check_03(self):
"""
type A;
type B;
type C {
link foo -> A {
using (SELECT B)
}
}
""" | type A;
type B;
type C {
link foo -> A {
using (SELECT B)
}
} | test_schema_target_consistency_check_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_wrong_type_01(self):
"""
scalar type X extending enum<TEST>;
type Y extending X {}
""" | scalar type X extending enum<TEST>;
type Y extending X {} | test_schema_wrong_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_wrong_type_02(self):
"""
type X;
type Y { constraint X; }
""" | type X;
type Y { constraint X; } | test_schema_wrong_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_duplicate_def_01(self):
"""
type T;
type T;
""" | type T;
type T; | test_schema_duplicate_def_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_duplicate_def_02(self):
"""
type T {
property foo -> str;
property foo -> int64;
};
""" | type T {
property foo -> str;
property foo -> int64;
}; | test_schema_duplicate_def_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_duplicate_def_03(self):
"""
type T {
access policy foo allow all using (true);
access policy foo allow all using (true);
};
""" | type T {
access policy foo allow all using (true);
access policy foo allow all using (true);
}; | test_schema_duplicate_def_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_module_reserved_01(self):
"""
module foo {
module super {}
}
""" | module foo {
module super {}
} | test_schema_module_reserved_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_field_dupe_01(self):
"""
type SimpleNumbers {
property bar: str;
property foo: str {
default := '';
default := '';
}
}
""" | type SimpleNumbers {
property bar: str;
property foo: str {
default := '';
default := '';
}
} | test_schema_field_dupe_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_field_dupe_02(self):
"""
type SimpleNumbers {
property bar: str;
property foo: str {
default := .bar;
default := .bar;
}
}
""" | type SimpleNumbers {
property bar: str;
property foo: str {
default := .bar;
default := .bar;
}
} | test_schema_field_dupe_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_field_dupe_03(self):
"""
type SimpleNumbers {
bar: str;
foo := .bar ++ "!";
foo := .bar ++ "!";
}
""" | type SimpleNumbers {
bar: str;
foo := .bar ++ "!";
foo := .bar ++ "!";
} | test_schema_field_dupe_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_object_as_lprop_01(self):
"""
type Tgt;
type Tgt2;
type Src {
multi tgts: Tgt {
lprop: Tgt2;
}
};
""" | type Tgt;
type Tgt2;
type Src {
multi tgts: Tgt {
lprop: Tgt2;
}
}; | test_schema_object_as_lprop_01 | python | geldata/gel | tests/test_schema.py | https://github.com/geldata/gel/blob/master/tests/test_schema.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.