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_edgeql_ir_mult_inference_22(self):
"""
SELECT User.name ++ Card.name
% OK %
DUPLICATE
""" | SELECT User.name ++ Card.name
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_22 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_23(self):
"""
SELECT to_str(1)
% OK %
UNIQUE
""" | SELECT to_str(1)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_23 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_24(self):
"""
WITH
C := (SELECT Card FILTER .name = 'Imp')
SELECT str_split(<str>C.id, '')
% OK %
UNIQUE
""" | WITH
C := (SELECT Card FILTER .name = 'Imp')
SELECT str_split(<str>C.id, '')
% OK %
UNIQUE | test_edgeql_ir_mult_inference_24 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_25(self):
# Any time a function returns a set for any reason the
# multiplicity cannot be reliably inferred.
#
# We don't know what a set-returning function really does.
#
# We also don't know that an element-wise function doesn't end
# up with collisions.
"""
SELECT str_split(<str>Card.id, '')
% OK %
DUPLICATE
""" | SELECT str_split(<str>Card.id, '')
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_25 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_26(self):
# Any time a function returns a set for any reason the
# multiplicity cannot be reliably inferred.
#
# We don't know what a set-returning function really does.
#
# We also don't know that an element-wise function doesn't end
# up with collisions.
"""
SELECT array_unpack(str_split(<str>Card.id, ''))
% OK %
DUPLICATE
""" | SELECT array_unpack(str_split(<str>Card.id, ''))
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_26 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_27(self):
"""
SELECT count(Card)
% OK %
UNIQUE
""" | SELECT count(Card)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_27 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_28(self):
"""
SELECT 1 IN {1, 2, 3}
% OK %
UNIQUE
""" | SELECT 1 IN {1, 2, 3}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_28 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_29(self):
"""
SELECT 1 IN {1, 1, 3}
% OK %
UNIQUE
""" | SELECT 1 IN {1, 1, 3}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_29 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_30(self):
"""
SELECT {1, 2} IN {1, 2, 3}
% OK %
DUPLICATE
""" | SELECT {1, 2} IN {1, 2, 3}
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_30 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_31(self):
"""
SELECT Card.name IN {'Imp', 'Dragon'}
% OK %
DUPLICATE
""" | SELECT Card.name IN {'Imp', 'Dragon'}
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_31 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_32(self):
"""
SELECT <str>{1, 2, 3}
% OK %
UNIQUE
""" | SELECT <str>{1, 2, 3}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_32 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_33(self):
"""
SELECT <str>{1, 1, 3}
% OK %
DUPLICATE
""" | SELECT <str>{1, 1, 3}
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_33 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_34(self):
"""
SELECT <str>Card.id
% OK %
UNIQUE
""" | SELECT <str>Card.id
% OK %
UNIQUE | test_edgeql_ir_mult_inference_34 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_35(self):
"""
SELECT <json>User.name
% OK %
UNIQUE
""" | SELECT <json>User.name
% OK %
UNIQUE | test_edgeql_ir_mult_inference_35 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_36(self):
"""
SELECT <str>Card.cost
% OK %
DUPLICATE
""" | SELECT <str>Card.cost
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_36 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_37(self):
"""
SELECT User.deck[IS SpecialCard]
% OK %
UNIQUE
""" | SELECT User.deck[IS SpecialCard]
% OK %
UNIQUE | test_edgeql_ir_mult_inference_37 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_38(self):
"""
SELECT Award.<awards[IS User]
% OK %
UNIQUE
""" | SELECT Award.<awards[IS User]
% OK %
UNIQUE | test_edgeql_ir_mult_inference_38 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_39(self):
"""
SELECT (1, Card.name).0
% OK %
DUPLICATE
""" | SELECT (1, Card.name).0
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_39 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_40(self):
"""
SELECT (1, Card.name).1
% OK %
UNIQUE
""" | SELECT (1, Card.name).1
% OK %
UNIQUE | test_edgeql_ir_mult_inference_40 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_41(self):
"""
SELECT ['card', Card.name][0]
% OK %
DUPLICATE
""" | SELECT ['card', Card.name][0]
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_41 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_42(self):
# It's probably impractical to even try to infer that we're
# only fetching a unique array element here.
"""
SELECT ['card', Card.name][1]
% OK %
DUPLICATE
""" | SELECT ['card', Card.name][1]
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_42 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_43(self):
"""
SELECT DISTINCT Card.element
% OK %
UNIQUE
""" | SELECT DISTINCT Card.element
% OK %
UNIQUE | test_edgeql_ir_mult_inference_43 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_44(self):
"""
SELECT User {
friends_of_friends := .friends.friends,
others := (
SELECT WaterOrEarthCard.owners
)
}
% OK %
UNIQUE
""" | SELECT User {
friends_of_friends := .friends.friends,
others := (
SELECT WaterOrEarthCard.owners
)
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_44 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_45(self):
"""
SELECT Award {
owner := .<awards[IS User]
}
% OK %
UNIQUE
""" | SELECT Award {
owner := .<awards[IS User]
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_45 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_46(self):
"""
SELECT User {
card_names := .deck.name,
card_elements := DISTINCT .deck.element,
deck: {
el := User.deck.element[:2]
}
}
% OK %
UNIQUE
""" | SELECT User {
card_names := .deck.name,
card_elements := DISTINCT .deck.element,
deck: {
el := User.deck.element[:2]
}
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_46 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_47(self):
"""
SELECT 1 IS str
% OK %
UNIQUE
""" | SELECT 1 IS str
% OK %
UNIQUE | test_edgeql_ir_mult_inference_47 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_48(self):
"""
SELECT Award IS Named
% OK %
DUPLICATE
""" | SELECT Award IS Named
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_48 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_49(self):
"""
WITH
A := (
SELECT Award FILTER .name = 'Wow'
)
SELECT A IS Named
% OK %
UNIQUE
""" | WITH
A := (
SELECT Award FILTER .name = 'Wow'
)
SELECT A IS Named
% OK %
UNIQUE | test_edgeql_ir_mult_inference_49 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_50(self):
"""
SELECT Award.name IS str
% OK %
DUPLICATE
""" | SELECT Award.name IS str
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_50 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_51(self):
"""
SELECT INTROSPECT TYPEOF User.deck
% OK %
UNIQUE
""" | SELECT INTROSPECT TYPEOF User.deck
% OK %
UNIQUE | test_edgeql_ir_mult_inference_51 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_52(self):
"""
SELECT (INTROSPECT TYPEOF User.deck).name
% OK %
UNIQUE
""" | SELECT (INTROSPECT TYPEOF User.deck).name
% OK %
UNIQUE | test_edgeql_ir_mult_inference_52 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_53(self):
"""
SELECT User {
card_elements := .deck.element
}
% OK %
UNIQUE
""" | SELECT User {
card_elements := .deck.element
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_53 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_54(self):
"""
SELECT User {
foo := {1, 1, 2}
}
% OK %
UNIQUE
""" | SELECT User {
foo := {1, 1, 2}
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_54 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_55a(self):
"""
FOR x IN {'fire', 'water'}
UNION (
SELECT Card
FILTER .element = x
)
% OK %
UNIQUE
""" | FOR x IN {'fire', 'water'}
UNION (
SELECT Card
FILTER .element = x
)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_55a | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_55b(self):
"""
FOR letter IN {'I', 'B'}
UNION (
SELECT Card
FILTER .name[0] = letter
)
% OK %
DUPLICATE
""" | FOR letter IN {'I', 'B'}
UNION (
SELECT Card
FILTER .name[0] = letter
)
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_55b | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_56(self):
"""
SELECT User {
wishlist := (
FOR x IN {'fire', 'water'}
UNION (
SELECT Card
FILTER .element = x
)
)
}
% OK %
UNIQUE
""" | SELECT User {
wishlist := (
FOR x IN {'fire', 'water'}
UNION (
SELECT Card
FILTER .element = x
)
)
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_56 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_57(self):
"""
SELECT enumerate({2, 2})
% OK %
UNIQUE
""" | SELECT enumerate({2, 2})
% OK %
UNIQUE | test_edgeql_ir_mult_inference_57 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_58(self):
"""
SELECT enumerate(Card)
% OK %
UNIQUE
""" | SELECT enumerate(Card)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_58 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_59(self):
"""
FOR x IN {enumerate({'fire', 'water'})}
UNION (
SELECT Card
FILTER .element = x.1
)
% OK %
UNIQUE
""" | FOR x IN {enumerate({'fire', 'water'})}
UNION (
SELECT Card
FILTER .element = x.1
)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_59 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_59a(self):
"""
FOR x IN {enumerate({'fire', 'water'})}
UNION (
SELECT (
SELECT Card
FILTER .element = x.1
)
)
% OK %
UNIQUE
""" | FOR x IN {enumerate({'fire', 'water'})}
UNION (
SELECT (
SELECT Card
FILTER .element = x.1
)
)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_59a | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_60(self):
"""
FOR x IN {
enumerate(
DISTINCT array_unpack(['fire', 'water']))
}
UNION (
SELECT Card
FILTER .element = x.1
)
% OK %
UNIQUE
""" | FOR x IN {
enumerate(
DISTINCT array_unpack(['fire', 'water']))
}
UNION (
SELECT Card
FILTER .element = x.1
)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_60 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_61(self):
"""
FOR x IN {
enumerate(
array_unpack(['A', 'B']))
}
UNION (
INSERT Card {
name := x.1,
element := 'test',
cost := 0,
req_awards := {}, # wtvr
req_tags := {}, # wtvr
}
)
% OK %
UNIQUE
""" | FOR x IN {
enumerate(
array_unpack(['A', 'B']))
}
UNION (
INSERT Card {
name := x.1,
element := 'test',
cost := 0,
req_awards := {}, # wtvr
req_tags := {}, # wtvr
}
)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_61 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_62(self):
"""
SELECT Card UNION SpecialCard
% OK %
DUPLICATE
""" | SELECT Card UNION SpecialCard
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_62 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_63(self):
"""
FOR card IN {enumerate(Card)}
UNION (SELECT card.1)
% OK %
UNIQUE
""" | FOR card IN {enumerate(Card)}
UNION (SELECT card.1)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_63 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_64(self):
"""
FOR card IN {Card}
UNION card
% OK %
UNIQUE
""" | FOR card IN {Card}
UNION card
% OK %
UNIQUE | test_edgeql_ir_mult_inference_64 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_65(self):
"""
WITH C := <Card>{}
FOR card IN {C}
UNION card
% OK %
EMPTY
""" | WITH C := <Card>{}
FOR card IN {C}
UNION card
% OK %
EMPTY | test_edgeql_ir_mult_inference_65 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_66(self):
"""
FOR card IN {Card, SpecialCard}
UNION card
% OK %
DUPLICATE
""" | FOR card IN {Card, SpecialCard}
UNION card
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_66 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_67(self):
"""
SELECT
(SELECT User FILTER .name = "foo")
??
(SELECT User FILTER .name = "bar")
% OK %
UNIQUE
""" | SELECT
(SELECT User FILTER .name = "foo")
??
(SELECT User FILTER .name = "bar")
% OK %
UNIQUE | test_edgeql_ir_mult_inference_67 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_68(self):
"""
SELECT
(SELECT User FILTER .name = "foo")
??
{
User,
User,
}
% OK %
DUPLICATE
""" | SELECT
(SELECT User FILTER .name = "foo")
??
{
User,
User,
}
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_68 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_69(self):
"""
SELECT
{
(INSERT User { name := "a" }),
(INSERT User { name := "b" }),
}
% OK %
UNIQUE
""" | SELECT
{
(INSERT User { name := "a" }),
(INSERT User { name := "b" }),
}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_69 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_70(self):
"""
WITH
X1 := Card {
z := (.<deck[IS User],)
}
SELECT X1 {
foo := .z.0
}.foo
% OK %
UNIQUE
""" | WITH
X1 := Card {
z := (.<deck[IS User],)
}
SELECT X1 {
foo := .z.0
}.foo
% OK %
UNIQUE | test_edgeql_ir_mult_inference_70 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_71(self):
"""
FOR card IN {assert_distinct(Card UNION SpecialCard)}
UNION card
% OK %
UNIQUE
""" | FOR card IN {assert_distinct(Card UNION SpecialCard)}
UNION card
% OK %
UNIQUE | test_edgeql_ir_mult_inference_71 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_error_01(self):
"""
SELECT User {
bad_link := {Card, Card},
name,
}
""" | SELECT User {
bad_link := {Card, Card},
name,
} | test_edgeql_ir_mult_inference_error_01 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_error_02(self):
"""
WITH
A := {Card, Card}
SELECT User {
bad_link := A,
name,
}
""" | WITH
A := {Card, Card}
SELECT User {
bad_link := A,
name,
} | test_edgeql_ir_mult_inference_error_02 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_72(self):
"""
SELECT ()
% OK %
UNIQUE
""" | SELECT ()
% OK %
UNIQUE | test_edgeql_ir_mult_inference_72 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_73(self):
"""
SELECT {(), ()}
% OK %
DUPLICATE
""" | SELECT {(), ()}
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_73 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_74(self):
"""
SELECT <array<str>>[]
% OK %
UNIQUE
""" | SELECT <array<str>>[]
% OK %
UNIQUE | test_edgeql_ir_mult_inference_74 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_75(self):
"""
SELECT <str>{}
% OK %
EMPTY
""" | SELECT <str>{}
% OK %
EMPTY | test_edgeql_ir_mult_inference_75 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_76(self):
"""
SELECT (Card, User).1
% OK %
DUPLICATE
""" | SELECT (Card, User).1
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_76 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_77(self):
"""
for x in {1, 2} union { foo := 10 }
% OK %
UNIQUE
""" | for x in {1, 2} union { foo := 10 }
% OK %
UNIQUE | test_edgeql_ir_mult_inference_77 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_78(self):
"""
with F := { foo := 10 }
for x in {1, 2} union F
% OK %
DUPLICATE
""" | with F := { foo := 10 }
for x in {1, 2} union F
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_78 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_79(self):
"""
for x in {1, 2, 3} union (with z := x, select z)
% OK %
UNIQUE
""" | for x in {1, 2, 3} union (with z := x, select z)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_79 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_80(self):
"""
for x in {1,2} union (for y in {3, 4} union x)
% OK %
DUPLICATE
""" | for x in {1,2} union (for y in {3, 4} union x)
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_80 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_81(self):
"""
for x in {1,2} union (for y in {3, 4} union y)
% OK %
DUPLICATE
""" | for x in {1,2} union (for y in {3, 4} union y)
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_81 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_82(self):
"""
select 1 union 1
% OK %
DUPLICATE
""" | select 1 union 1
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_82 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_83(self):
"""
select 1 + (2 intersect 3)
% OK %
UNIQUE
""" | select 1 + (2 intersect 3)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_83 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_84(self):
"""
select 1 + (2 intersect {3, 3})
% OK %
UNIQUE
""" | select 1 + (2 intersect {3, 3})
% OK %
UNIQUE | test_edgeql_ir_mult_inference_84 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_85(self):
"""
select 1 + ({2, 2} intersect {3, 3})
% OK %
DUPLICATE
""" | select 1 + ({2, 2} intersect {3, 3})
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_85 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_86(self):
"""
select {2, 2} intersect <int64>{}
% OK %
EMPTY
""" | select {2, 2} intersect <int64>{}
% OK %
EMPTY | test_edgeql_ir_mult_inference_86 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_87(self):
"""
select 1 + (2 except 3)
% OK %
UNIQUE
""" | select 1 + (2 except 3)
% OK %
UNIQUE | test_edgeql_ir_mult_inference_87 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_88(self):
"""
select 1 + (2 except {3, 3})
% OK %
UNIQUE
""" | select 1 + (2 except {3, 3})
% OK %
UNIQUE | test_edgeql_ir_mult_inference_88 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_89(self):
"""
select 1 + ({2, 2} except {3, 3})
% OK %
DUPLICATE
""" | select 1 + ({2, 2} except {3, 3})
% OK %
DUPLICATE | test_edgeql_ir_mult_inference_89 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_90(self):
"""
if <bool>$0 then
(insert User { name := "test" })
else
(insert User { name := "???" })
% OK %
UNIQUE
""" | if <bool>$0 then
(insert User { name := "test" })
else
(insert User { name := "???" })
% OK %
UNIQUE | test_edgeql_ir_mult_inference_90 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_91(self):
"""
if <bool>$0 then
(insert User { name := "test" })
else
{(insert User { name := "???" }), (insert User { name := "!!!" })}
% OK %
UNIQUE
""" | if <bool>$0 then
(insert User { name := "test" })
else
{(insert User { name := "???" }), (insert User { name := "!!!" })}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_91 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
def test_edgeql_ir_mult_inference_92(self):
"""
if <bool>$0 then
(insert User { name := "test" })
else
<User>{}
% OK %
UNIQUE
""" | if <bool>$0 then
(insert User { name := "test" })
else
<User>{}
% OK %
UNIQUE | test_edgeql_ir_mult_inference_92 | python | geldata/gel | tests/test_edgeql_ir_mult_inference.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_ir_mult_inference.py | Apache-2.0 |
async def test_edgeql_insert_simple_01(self):
await self.con.execute(r"""
INSERT InsertTest {
name := 'insert simple 01',
l2 := 0,
};
INSERT InsertTest {
name := 'insert simple 01',
l3 := "Test\"1\"",
l2 := 1
};
INSERT InsertTest {
name := 'insert simple 01',
l3 := 'Test\'2\'',
l2 := 2
};
INSERT InsertTest {
name := 'insert simple 01',
l3 := '\"Test\'3\'\"',
l2 := 3
};
""")
await self.assert_query_result(
r"""
SELECT
InsertTest {
l2, l3
}
FILTER
InsertTest.name = 'insert simple 01'
ORDER BY
InsertTest.l2;
""",
[
{
'l2': 0,
'l3': 'test',
},
{
'l2': 1,
'l3': 'Test"1"',
},
{
'l2': 2,
'l3': "Test'2'",
},
{
'l2': 3,
'l3': '''"Test'3'"''',
}
]
) | )
await self.assert_query_result(
r | test_edgeql_insert_simple_01 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_simple_02(self):
await self.con.execute('''
INSERT DefaultTest1 { foo := '02' };
INSERT DefaultTest1 { foo := '02' };
INSERT DefaultTest1 { foo := '02' };
''')
await self.assert_query_result(
r'''
SELECT DefaultTest1 { num } FILTER DefaultTest1.foo = '02';
''',
[{'num': 42}, {'num': 42}, {'num': 42}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_simple_02 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_simple_03(self):
await self.con.execute('''
INSERT DefaultTest1 { num := 100 };
INSERT DefaultTest2;
INSERT DefaultTest1 { num := 101 };
INSERT DefaultTest2;
INSERT DefaultTest1 { num := 102 };
INSERT DefaultTest2;
''')
await self.assert_query_result(
r'''
SELECT DefaultTest2 { num }
ORDER BY DefaultTest2.num;
''',
[{'num': 101}, {'num': 102}, {'num': 103}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_simple_03 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_unused_01(self):
await self.con.execute(r"""
with _ := (
INSERT InsertTest {
name := 'insert simple 01',
l2 := 0,
}
), select 1;
""")
await self.assert_query_result(
r"""
SELECT
InsertTest {
l2
}
FILTER
InsertTest.name = 'insert simple 01'
""",
[
{
'l2': 0,
},
]
)
await self.con.execute(r"""
with _ := (
INSERT InsertTest {
name := 'insert simple 01',
l2 := (select 1 filter true),
}
),
INSERT InsertTest {
name := 'insert simple 01',
l2 := 2,
}
""")
await self.assert_query_result(
r"""
SELECT
InsertTest {
l2
}
FILTER
InsertTest.name = 'insert simple 01'
ORDER BY .l2
""",
[
{'l2': 0},
{'l2': 1},
{'l2': 2},
]
) | )
await self.assert_query_result(
r | test_edgeql_insert_unused_01 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_01(self):
await self.con.execute('''
INSERT Subordinate {
name := 'subtest 1'
};
INSERT Subordinate {
name := 'subtest 2'
};
INSERT InsertTest {
name := 'insert nested',
l2 := 0,
subordinates := (
SELECT Subordinate
FILTER Subordinate.name LIKE 'subtest%'
)
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
subordinates: {
name,
@comment,
} ORDER BY InsertTest.subordinates.name
}
FILTER
InsertTest.name = 'insert nested';
''',
[{
'subordinates': [{
'name': 'subtest 1',
'@comment': None,
}, {
'name': 'subtest 2',
'@comment': None,
}]
}]
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_01 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_02(self):
await self.con.execute('''
INSERT Subordinate {
name := 'subtest 3'
};
INSERT Subordinate {
name := 'subtest 4'
};
INSERT InsertTest {
name := 'insert nested 2',
l2 := 0,
subordinates := (
SELECT Subordinate {
@comment := (SELECT 'comment ' ++ Subordinate.name)
}
FILTER Subordinate.name IN {'subtest 3', 'subtest 4'}
)
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
subordinates: {
name,
@comment,
} ORDER BY InsertTest.subordinates.name
}
FILTER
InsertTest.name = 'insert nested 2';
''',
[{
'subordinates': [{
'name': 'subtest 3',
'@comment': 'comment subtest 3',
}, {
'name': 'subtest 4',
'@comment': 'comment subtest 4',
}]
}]
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_02 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_03(self):
await self.con.execute('''
INSERT InsertTest {
name := 'insert nested 3',
l2 := 0,
subordinates := (INSERT Subordinate {
name := 'nested sub 3.1'
})
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
subordinates: {
name
} ORDER BY InsertTest.subordinates.name
}
FILTER
InsertTest.name = 'insert nested 3';
''',
[{
'subordinates': [{
'name': 'nested sub 3.1'
}]
}]
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_03 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_04(self):
await self.con.execute('''
INSERT InsertTest {
name := 'insert nested 4',
l2 := 0,
subordinates := (INSERT Subordinate {
name := 'nested sub 4.1',
@comment := 'comment 4.1',
})
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
subordinates: {
name,
@comment,
} ORDER BY InsertTest.subordinates.name
}
FILTER
InsertTest.name = 'insert nested 4';
''',
[{
'subordinates': [{
'name': 'nested sub 4.1',
'@comment': 'comment 4.1'
}]
}]
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_04 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_05(self):
await self.con.execute('''
INSERT Subordinate {
name := 'only subordinate'
};
INSERT Subordinate {
name := 'never subordinate'
};
INSERT InsertTest {
name := 'insert nested 5',
l2 := 0,
subordinates := (
SELECT Subordinate
FILTER Subordinate.name = 'only subordinate'
)
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
name,
l2,
subordinates: {
name
}
} FILTER InsertTest.name = 'insert nested 5';
''',
[{
'name': 'insert nested 5',
'l2': 0,
'subordinates': [{
'name': 'only subordinate'
}]
}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_05 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_06(self):
await self.con.execute('''
INSERT Subordinate {
name := 'linkprop test target 6'
};
INSERT InsertTest {
name := 'insert nested 6',
l2 := 0,
subordinates := (
SELECT Subordinate {
@comment := 'comment 6'
}
LIMIT 1
)
};
''')
await self.assert_query_result(
r'''
SELECT InsertTest {
subordinates: {
name,
@comment,
}
}
FILTER
InsertTest.name = 'insert nested 6';
''',
[{
'subordinates': [{
'name': 'linkprop test target 6',
'@comment': 'comment 6'
}]
}]
) | )
await self.assert_query_result(
r | test_edgeql_insert_nested_06 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_09(self):
# test a single link with a link property
await self.con.execute(r'''
INSERT InsertTest {
name := 'insert nested 9',
l2 := 0,
sub := (
INSERT Subordinate {
name := 'nested sub 9',
@note := 'sub note 9',
}
)
}
''')
await self.assert_query_result(r'''
SELECT InsertTest {
name,
sub: {
name,
@note
}
} FILTER
.name = 'insert nested 9'
''', [{
'name': 'insert nested 9',
'sub': {
'name': 'nested sub 9',
'@note': 'sub note 9',
}
}]) | )
await self.assert_query_result(r | test_edgeql_insert_nested_09 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_10(self):
# test a single link with a link property
await self.con.execute(r'''
INSERT Subordinate {
name := 'nested sub 10',
};
INSERT InsertTest {
name := 'insert nested 10',
l2 := 0,
sub := (
SELECT Subordinate {
@note := 'sub note 10',
}
FILTER .name = 'nested sub 10'
LIMIT 1
)
}
''')
await self.assert_query_result(r'''
SELECT InsertTest {
name,
sub: {
name,
@note
}
} FILTER
.name = 'insert nested 10'
''', [{
'name': 'insert nested 10',
'sub': {
'name': 'nested sub 10',
'@note': 'sub note 10',
}
}]) | )
await self.assert_query_result(r | test_edgeql_insert_nested_10 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_11(self):
await self.con.execute('''
INSERT Subordinate {
name := 'linkprop test target 6'
};
''')
await self.assert_query_result(
'''
SELECT (
INSERT InsertTest {
name := 'insert nested 6',
l2 := 0,
subordinates := (
SELECT (SELECT Subordinate LIMIT 1) {
@comment := 'comment 6'
}
)
}
) {
subordinates: { name, @comment }
}
''',
[{
'subordinates': [{
'name': 'linkprop test target 6',
'@comment': 'comment 6'
}]
}]
) | )
await self.assert_query_result( | test_edgeql_insert_nested_11 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_nested_12(self):
# Ugh, set a default value on the link prop
await self.con.execute('''
ALTER TYPE InsertTest
ALTER LINK subordinates
ALTER PROPERTY comment
SET default := "!!!";
''')
await self.con.execute('''
INSERT Subordinate {
name := 'linkprop test target 6'
};
''')
await self.assert_query_result(
'''
SELECT (
INSERT InsertTest {
name := 'insert nested 6',
l2 := 0,
subordinates := (
SELECT Subordinate LIMIT 1
)
}
) {
subordinates: { name, @comment }
}
''',
[{
'subordinates': [{
'name': 'linkprop test target 6',
'@comment': '!!!'
}]
}]
) | )
await self.con.execute( | test_edgeql_insert_nested_12 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_01(self):
await self.con.execute('''
INSERT DefaultTest1 {
foo := 'ret1',
num := 1,
};
''')
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest1 {
foo := 'ret2',
num := 2,
}) {foo};
''',
[{
'foo': 'ret2',
}],
)
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest1 {
foo := 'ret3',
num := 3,
}).num;
''',
[3],
) | )
await self.assert_query_result(
r | test_edgeql_insert_returning_01 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_02(self):
await self.assert_query_result(
'''
INSERT DefaultTest1 {
foo := 'ret1',
num := 1,
};
''',
[{
'id': uuid.UUID,
}],
)
await self.assert_query_result(
'''
SELECT (INSERT DefaultTest1 {
foo := 'ret2',
num := 2,
}) {foo};
''',
[{
'foo': 'ret2',
}],
)
await self.assert_query_result(
'''
SELECT (INSERT DefaultTest1 {
foo := 'ret3',
num := 3,
}).num;
''',
[3],
)
obj = await self.con._fetchall(
'''
INSERT DefaultTest1 {
foo := 'ret1',
num := 1,
};
''',
__typeids__=True,
__typenames__=True,
)
self.assertTrue(hasattr(obj[0], 'id'))
self.assertTrue(hasattr(obj[0], '__tid__'))
self.assertEqual(obj[0].__tname__, 'default::DefaultTest1') | INSERT DefaultTest1 {
foo := 'ret1',
num := 1,
};
''',
[{
'id': uuid.UUID,
}],
)
await self.assert_query_result( | test_edgeql_insert_returning_02 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_03(self):
await self.con.execute('''
INSERT Subordinate {
name := 'sub returning 3'
};
''')
await self.assert_query_result(
r'''
WITH
I := (INSERT InsertTest {
name := 'insert nested returning 3',
l2 := 0,
subordinates := (
SELECT Subordinate
FILTER Subordinate.name = 'sub returning 3'
)
})
SELECT I {
name,
l2,
subordinates: {
name
}
};
''',
[{
'name': 'insert nested returning 3',
'l2': 0,
'subordinates': [{
'name': 'sub returning 3'
}]
}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_returning_03 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_04(self):
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest1 {
foo := 'DT returning 4',
num := 33,
}) {foo, num};
''',
[{
'foo': 'DT returning 4',
'num': 33,
}],
)
await self.assert_query_result(
r'''
WITH
I := (INSERT InsertTest {
name := 'IT returning 4',
l2 := 9999,
})
SELECT
DefaultTest1 {foo, num}
FILTER DefaultTest1.num > I.l2;
''',
[],
)
await self.assert_query_result(
r'''
WITH
I := (INSERT InsertTest {
name := 'IT returning 4',
l2 := 9,
})
SELECT
DefaultTest1 {foo, num}
FILTER DefaultTest1.num > I.l2;
''',
[{
'foo': 'DT returning 4',
'num': 33,
}],
) | ,
[{
'foo': 'DT returning 4',
'num': 33,
}],
)
await self.assert_query_result(
r | test_edgeql_insert_returning_04 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_06(self):
await self.con.execute('''
INSERT Subordinate {
name := 'DefaultTest5/Sub'
};
''')
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest5 {
name := 'ret6/DT5',
}) {
name,
# test that other will show up with the default value
other: {
name
},
};
''',
[{
'name': 'ret6/DT5',
'other': {
'name': 'DefaultTest5/Sub',
}
}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_returning_06 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_07(self):
await self.con.execute('''
INSERT Subordinate {
name := 'DefaultTest5/Sub'
};
''')
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest6 {
name := 'ret7/DT6',
}) {
name,
# test that other will show up with the default value
other: {
name,
other: {
name
},
},
};
''',
[{
'name': 'ret7/DT6',
'other': {
'name': 'DefaultTest6/5',
'other': {
'name': 'DefaultTest5/Sub',
}
}
}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_returning_07 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_08(self):
await self.con.execute('''
INSERT Subordinate {
name := 'DefaultTest5/Sub'
};
''')
await self.assert_query_result(
r'''
SELECT (INSERT DefaultTest7 {
name := 'ret8/DT7',
}) {
name,
# test that other will show up with the default value
other: {
name,
other: {
name,
other: {
name,
},
},
},
};
''',
[{
'name': 'ret8/DT7',
'other': {
'name': 'DefaultTest7/6',
'other': {
'name': 'DefaultTest6/5',
'other': {
'name': 'DefaultTest5/Sub',
}
}
}
}],
) | )
await self.assert_query_result(
r | test_edgeql_insert_returning_08 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_09(self):
# make sure a WITH bound insert makes it into the returned data
await self.assert_query_result(
r'''
WITH N := (INSERT Note {name := "!" }),
SELECT ((
INSERT Person {
name := "Phil Emarg",
notes := N,
}
)) { name, notes: {name} };
''',
[{
'name': 'Phil Emarg',
'notes': [{'name': '!'}],
}],
)
# make sure it works when *doubly* nested!
await self.assert_query_result(
r'''
WITH S := (INSERT Subordinate { name := "sub" }),
N := (INSERT Note {name := "!", subject := S }),
SELECT ((
INSERT Person {
name := "Madeline Hatch",
notes := N,
}
)) { name, notes: {name, subject[IS Subordinate]: {name}} };
''',
[{
'name': 'Madeline Hatch',
'notes': [{'name': '!', 'subject': {'name': "sub"}}],
}],
)
# ... *doubly* nested, but the inner insert is a multi link
await self.assert_query_result(
r'''
WITH N := (INSERT Note {name := "!" }),
P := (INSERT Person {
name := "Emmanuel Villip",
notes := N,
}),
SELECT ((
INSERT PersonWrapper { person := P }
)) { person: { name, notes: {name} } };
''',
[{
'person': {
'name': 'Emmanuel Villip',
'notes': [{'name': '!'}],
},
}],
) | ,
[{
'name': 'Phil Emarg',
'notes': [{'name': '!'}],
}],
)
# make sure it works when *doubly* nested!
await self.assert_query_result(
r | test_edgeql_insert_returning_09 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_11(self):
await self.con.execute(r'''
INSERT Note { name := "note", note := "a" };
''')
# test that subtypes get returned by a nested update
await self.assert_query_result(
r'''
SELECT
(INSERT Person {
name := "test",
notes := (
UPDATE Note FILTER .name = "note"
SET { note := "b" }
)
})
{ name, notes: {note} };
''',
[{
'name': 'test',
'notes': [{'note': "b"}],
}],
) | )
# test that subtypes get returned by a nested update
await self.assert_query_result(
r | test_edgeql_insert_returning_11 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_12(self):
await self.con.execute(r'''
INSERT DerivedNote { name := "note", note := "a" };
''')
# test that subtypes get returned by a nested update
await self.assert_query_result(
r'''
SELECT
(INSERT Person {
name := "test",
notes := (
UPDATE DerivedNote FILTER .name = "note"
SET { note := "b" }
)
})
{ name, notes: {note} };
''',
[{
'name': 'test',
'notes': [{'note': "b"}],
}],
) | )
# test that subtypes get returned by a nested update
await self.assert_query_result(
r | test_edgeql_insert_returning_12 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
async def test_edgeql_insert_returning_13(self):
await self.con.execute(r'''
INSERT DerivedNote { name := "dnote", note := "a" };
INSERT DerivedNote { name := "anote", note := "some note" };
''')
# test that subtypes get returned by a nested update
await self.assert_query_result(
r'''
SELECT
(INSERT Person {
name := "test",
notes := assert_distinct({
(SELECT Note FILTER .name = "anote"),
(INSERT DerivedNote { name := "new note", note := "hi" }),
(UPDATE Note FILTER .name = "dnote" SET { note := "b" }),
})
})
{ name, notes: {name, note} ORDER BY .name };
''',
[
{
"name": "test",
"notes": [
{"name": "anote", "note": "some note"},
{"name": "dnote", "note": "b"},
{"name": "new note", "note": "hi"}
]
}
]
) | )
# test that subtypes get returned by a nested update
await self.assert_query_result(
r | test_edgeql_insert_returning_13 | python | geldata/gel | tests/test_edgeql_insert.py | https://github.com/geldata/gel/blob/master/tests/test_edgeql_insert.py | Apache-2.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.