Coverage for databases/sync_tests/arrays/push/test_string.py: 100%
9 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
1from prisma import Prisma
4def test_pushing_strings(client: Prisma) -> None:
5 """Pushing a String[] value"""
6 models = [
7 client.lists.create({}),
8 client.lists.create(
9 data={
10 'strings': ['a', 'b', 'c'],
11 },
12 ),
13 ]
15 model = client.lists.update(
16 where={
17 'id': models[0].id,
18 },
19 data={
20 'strings': {
21 'push': ['a', 'B'],
22 },
23 },
24 )
25 assert model is not None
26 assert model.strings == ['a', 'B']
28 model = client.lists.update(
29 where={
30 'id': models[1].id,
31 },
32 data={
33 'strings': {
34 'push': ['d'],
35 },
36 },
37 )
38 assert model is not None
39 assert model.strings == ['a', 'b', 'c', 'd']