Coverage for databases/tests/arrays/push/test_bool.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
1import pytest
3from prisma import Prisma
6@pytest.mark.asyncio
7async def test_pushing_boolean(client: Prisma) -> None:
8 """Pushing values to a Boolean[] field"""
9 models = [
10 await client.lists.create({}),
11 await client.lists.create(
12 data={
13 'bools': [False, True],
14 },
15 ),
16 ]
18 model = await client.lists.update(
19 where={
20 'id': models[0].id,
21 },
22 data={
23 'bools': {
24 'push': [True, False, True],
25 },
26 },
27 )
28 assert model is not None
29 assert model.bools == [True, False, True]
31 model = await client.lists.update(
32 where={
33 'id': models[1].id,
34 },
35 data={
36 'bools': {
37 'push': [False],
38 },
39 },
40 )
41 assert model is not None
42 assert model.bools == [False, True, False]