Skip to content

Commit

Permalink
revert accidental test_array.py changes
Browse files Browse the repository at this point in the history
they weren't meant to be in this branch
  • Loading branch information
dantownsend committed Jun 7, 2024
1 parent c1e89af commit c84d704
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/columns/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Timestamptz,
)
from piccolo.table import Table
from tests.base import engines_only, engines_skip, sqlite_only
from tests.base import engines_only, sqlite_only


class MyTable(Table):
Expand Down Expand Up @@ -40,6 +40,7 @@ def setUp(self):
def tearDown(self):
MyTable.alter().drop_table().run_sync()

@engines_only("postgres", "sqlite")
def test_storage(self):
"""
Make sure data can be stored and retrieved.
Expand All @@ -53,7 +54,7 @@ def test_storage(self):
assert row is not None
self.assertEqual(row.value, [1, 2, 3])

@engines_skip("sqlite")
@engines_only("postgres")
def test_index(self):
"""
Indexes should allow individual array elements to be queried.
Expand All @@ -67,7 +68,7 @@ def test_index(self):
MyTable.select(MyTable.value[0]).first().run_sync(), {"value": 1}
)

@engines_skip("sqlite")
@engines_only("postgres")
def test_all(self):
"""
Make sure rows can be retrieved where all items in an array match a
Expand All @@ -94,7 +95,7 @@ def test_all(self):
None,
)

@engines_skip("sqlite")
@engines_only("postgres")
def test_any(self):
"""
Make sure rows can be retrieved where any items in an array match a
Expand All @@ -121,7 +122,7 @@ def test_any(self):
None,
)

@engines_skip("sqlite")
@engines_only("postgres")
def test_cat(self):
"""
Make sure values can be appended to an array.
Expand All @@ -136,8 +137,7 @@ def test_cat(self):
).run_sync()

self.assertEqual(
MyTable.select(MyTable.value).run_sync(),
[{"value": [1, 1, 1, 2]}],
MyTable.select().run_sync(), [{"id": 1, "value": [1, 1, 1, 2]}]
)

# Try plus symbol
Expand All @@ -147,8 +147,7 @@ def test_cat(self):
).run_sync()

self.assertEqual(
MyTable.select(MyTable.value).run_sync(),
[{"value": [1, 1, 1, 2, 3]}],
MyTable.select().run_sync(), [{"id": 1, "value": [1, 1, 1, 2, 3]}]
)

# Make sure non-list values work
Expand All @@ -158,8 +157,8 @@ def test_cat(self):
).run_sync()

self.assertEqual(
MyTable.select(MyTable.value).run_sync(),
[{"value": [1, 1, 1, 2, 3, 4]}],
MyTable.select().run_sync(),
[{"id": 1, "value": [1, 1, 1, 2, 3, 4]}],
)

@sqlite_only
Expand Down

0 comments on commit c84d704

Please sign in to comment.