piccolo 1.11.0__py3-none-any.whl → 1.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- piccolo/__init__.py +1 -1
- piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +35 -30
- piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +29 -21
- piccolo/apps/migrations/auto/migration_manager.py +1 -0
- piccolo/apps/migrations/commands/forwards.py +8 -7
- piccolo/apps/playground/commands/run.py +11 -0
- piccolo/columns/column_types.py +55 -0
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/METADATA +15 -15
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/RECORD +38 -38
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/WHEEL +1 -1
- tests/apps/migrations/commands/test_forwards_backwards.py +32 -1
- tests/columns/test_array.py +3 -7
- tests/columns/test_bigint.py +3 -9
- tests/columns/test_boolean.py +3 -7
- tests/columns/test_bytea.py +5 -14
- tests/columns/test_choices.py +5 -14
- tests/columns/test_date.py +5 -13
- tests/columns/test_double_precision.py +3 -8
- tests/columns/test_interval.py +5 -13
- tests/columns/test_json.py +9 -26
- tests/columns/test_jsonb.py +3 -11
- tests/columns/test_numeric.py +3 -7
- tests/columns/test_primary_key.py +11 -33
- tests/columns/test_readable.py +5 -7
- tests/columns/test_real.py +3 -8
- tests/columns/test_reserved_column_names.py +3 -8
- tests/columns/test_smallint.py +3 -8
- tests/columns/test_time.py +5 -14
- tests/columns/test_timestamp.py +5 -13
- tests/columns/test_timestamptz.py +5 -13
- tests/columns/test_uuid.py +3 -7
- tests/columns/test_varchar.py +3 -9
- tests/query/functions/base.py +2 -15
- tests/query/functions/test_datetime.py +2 -4
- tests/query/functions/test_math.py +2 -3
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/LICENSE +0 -0
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/entry_points.txt +0 -0
- {piccolo-1.11.0.dist-info → piccolo-1.12.0.dist-info}/top_level.txt +0 -0
tests/columns/test_varchar.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
from unittest import TestCase
|
2
|
-
|
3
1
|
from piccolo.columns.column_types import Varchar
|
4
2
|
from piccolo.table import Table
|
5
3
|
|
6
|
-
from ..base import engines_only
|
4
|
+
from ..base import TableTest, engines_only
|
7
5
|
|
8
6
|
|
9
7
|
class MyTable(Table):
|
@@ -11,7 +9,7 @@ class MyTable(Table):
|
|
11
9
|
|
12
10
|
|
13
11
|
@engines_only("postgres", "cockroach")
|
14
|
-
class TestVarchar(
|
12
|
+
class TestVarchar(TableTest):
|
15
13
|
"""
|
16
14
|
SQLite doesn't enforce any constraints on max character length.
|
17
15
|
|
@@ -20,11 +18,7 @@ class TestVarchar(TestCase):
|
|
20
18
|
Might consider enforcing this at the ORM level instead in the future.
|
21
19
|
"""
|
22
20
|
|
23
|
-
|
24
|
-
MyTable.create_table().run_sync()
|
25
|
-
|
26
|
-
def tearDown(self):
|
27
|
-
MyTable.alter().drop_table().run_sync()
|
21
|
+
tables = [MyTable]
|
28
22
|
|
29
23
|
def test_length(self):
|
30
24
|
row = MyTable(name="bob")
|
tests/query/functions/base.py
CHANGED
@@ -1,21 +1,8 @@
|
|
1
|
-
|
2
|
-
from unittest import TestCase
|
3
|
-
|
4
|
-
from piccolo.table import Table, create_db_tables_sync, drop_db_tables_sync
|
1
|
+
from tests.base import TableTest
|
5
2
|
from tests.example_apps.music.tables import Band, Manager
|
6
3
|
|
7
4
|
|
8
|
-
class
|
9
|
-
tables: t.List[t.Type[Table]]
|
10
|
-
|
11
|
-
def setUp(self) -> None:
|
12
|
-
create_db_tables_sync(*self.tables)
|
13
|
-
|
14
|
-
def tearDown(self) -> None:
|
15
|
-
drop_db_tables_sync(*self.tables)
|
16
|
-
|
17
|
-
|
18
|
-
class BandTest(FunctionTest):
|
5
|
+
class BandTest(TableTest):
|
19
6
|
tables = [Band, Manager]
|
20
7
|
|
21
8
|
def setUp(self) -> None:
|
@@ -12,16 +12,14 @@ from piccolo.query.functions.datetime import (
|
|
12
12
|
Year,
|
13
13
|
)
|
14
14
|
from piccolo.table import Table
|
15
|
-
from tests.base import engines_only, sqlite_only
|
16
|
-
|
17
|
-
from .base import FunctionTest
|
15
|
+
from tests.base import TableTest, engines_only, sqlite_only
|
18
16
|
|
19
17
|
|
20
18
|
class Concert(Table):
|
21
19
|
starts = Timestamp()
|
22
20
|
|
23
21
|
|
24
|
-
class DatetimeTest(
|
22
|
+
class DatetimeTest(TableTest):
|
25
23
|
tables = [Concert]
|
26
24
|
|
27
25
|
def setUp(self) -> None:
|
@@ -3,15 +3,14 @@ import decimal
|
|
3
3
|
from piccolo.columns import Numeric
|
4
4
|
from piccolo.query.functions.math import Abs, Ceil, Floor, Round
|
5
5
|
from piccolo.table import Table
|
6
|
-
|
7
|
-
from .base import FunctionTest
|
6
|
+
from tests.base import TableTest
|
8
7
|
|
9
8
|
|
10
9
|
class Ticket(Table):
|
11
10
|
price = Numeric(digits=(5, 2))
|
12
11
|
|
13
12
|
|
14
|
-
class TestMath(
|
13
|
+
class TestMath(TableTest):
|
15
14
|
|
16
15
|
tables = [Ticket]
|
17
16
|
|
File without changes
|
File without changes
|
File without changes
|