Skip to content

Commit

Permalink
Add e2e test for codegen
Browse files Browse the repository at this point in the history
Test case copied from edgedb-go

Co-Authored-By: fmoor <[email protected]>
  • Loading branch information
fantix and fmoor committed Oct 7, 2022
1 parent 396e38c commit 944c496
Show file tree
Hide file tree
Showing 30 changed files with 1,499 additions and 0 deletions.
Empty file.
16 changes: 16 additions & 0 deletions tests/codegen/test-project1/generated_async_edgeql.py.assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# AUTOGENERATED FROM 'select_scalar.edgeql' WITH:
# $ edgedb-py --target async --file


from __future__ import annotations
import edgedb


async def select_scalar(
client: edgedb.AsyncIOClient,
) -> int:
return await client.query_single(
"""\
select 1;\
""",
)
1 change: 1 addition & 0 deletions tests/codegen/test-project1/select_scalar.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select 1;
25 changes: 25 additions & 0 deletions tests/codegen/test-project1/select_scalar_async_edgeql.py.assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# AUTOGENERATED FROM 'select_scalar.edgeql' WITH:
# $ edgedb-py


from __future__ import annotations
import edgedb


class NoPydanticValidation:
@classmethod
def __get_validators__(cls):
from pydantic.dataclasses import dataclass as pydantic_dataclass
pydantic_dataclass(cls)
cls.__pydantic_model__.__get_validators__ = lambda: []
return []


async def select_scalar(
client: edgedb.AsyncIOClient,
) -> int:
return await client.query_single(
"""\
select 1;\
""",
)
16 changes: 16 additions & 0 deletions tests/codegen/test-project1/select_scalar_edgeql.py.assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# AUTOGENERATED FROM 'select_scalar.edgeql' WITH:
# $ edgedb-py --target blocking


from __future__ import annotations
import edgedb


def select_scalar(
client: edgedb.Client,
) -> int:
return client.query_single(
"""\
select 1;\
""",
)
1 change: 1 addition & 0 deletions tests/codegen/test-project2/argnames/query_one.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select <int64>$arg_name_with_underscores
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# AUTOGENERATED FROM 'argnames/query_one.edgeql' WITH:
# $ edgedb-py


from __future__ import annotations
import edgedb


class NoPydanticValidation:
@classmethod
def __get_validators__(cls):
from pydantic.dataclasses import dataclass as pydantic_dataclass
pydantic_dataclass(cls)
cls.__pydantic_model__.__get_validators__ = lambda: []
return []


async def query_one(
client: edgedb.AsyncIOClient,
*,
arg_name_with_underscores: int,
) -> int:
return await client.query_single(
"""\
select <int64>$arg_name_with_underscores\
""",
arg_name_with_underscores=arg_name_with_underscores,
)
19 changes: 19 additions & 0 deletions tests/codegen/test-project2/argnames/query_one_edgeql.py.assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AUTOGENERATED FROM 'argnames/query_one.edgeql' WITH:
# $ edgedb-py --target blocking


from __future__ import annotations
import edgedb


def query_one(
client: edgedb.Client,
*,
arg_name_with_underscores: int,
) -> int:
return client.query_single(
"""\
select <int64>$arg_name_with_underscores\
""",
arg_name_with_underscores=arg_name_with_underscores,
)
12 changes: 12 additions & 0 deletions tests/codegen/test-project2/dbschema/migrations/00001.edgeqll
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE MIGRATION m1fqtauhtvc2w56wh2676x5g26aye22ghx7b7mtnbfekxpmxmnjx2a
ONTO initial
{
CREATE TYPE default::Person {
CREATE MULTI LINK friends -> default::Person {
CREATE PROPERTY strength -> std::float64;
};
CREATE REQUIRED PROPERTY name -> std::str {
CREATE CONSTRAINT std::exclusive;
};
};
};
Empty file.
Loading

0 comments on commit 944c496

Please sign in to comment.