forked from geldata/gel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_indexes.py
71 lines (55 loc) · 1.6 KB
/
test_indexes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##
# Copyright (c) 2016-present MagicStack Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import uuid
from edgedb.server import _testbase as tb
class TestIndexes(tb.DDLTestCase):
async def test_index_01(self):
result = await self.con.execute("""
# setup delta
#
CREATE MIGRATION test::d1 TO eschema $$
concept Person:
link first_name to str
link last_name to str
index name_index on (__self__.first_name,
__self__.last_name)
$$;
COMMIT MIGRATION test::d1;
SELECT
schema::Concept {
indexes: {
expr
}
}
FILTER schema::Concept.name = 'test::Person';
INSERT test::Person {
first_name := 'Elon',
last_name := 'Musk'
};
WITH MODULE test
SELECT
Person {
first_name
}
FILTER
Person.first_name = 'Elon' AND Person.last_name = 'Musk';
""")
self.assert_data_shape(result, [
None,
None,
[{
'indexes': [{
'expr': 'SELECT (test::Person.first_name, '
'test::Person.last_name)'
}]
}],
[1],
[{
'id': uuid.UUID,
'first_name': 'Elon'
}]
])