Coverage for databases/sync_tests/arrays/push/test_bigint.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2024-08-27 18:25 +0000

1from prisma import Prisma 

2 

3 

4def test_pushing_bigints(client: Prisma) -> None: 

5 """Pushing values to a BigInt[] field""" 

6 models = [ 

7 client.lists.create({}), 

8 client.lists.create( 

9 data={ 

10 'bigints': [539506179039297536, 281454500584095754], 

11 }, 

12 ), 

13 ] 

14 

15 model = client.lists.update( 

16 where={ 

17 'id': models[0].id, 

18 }, 

19 data={ 

20 'bigints': { 

21 'push': [538075535121842179], 

22 }, 

23 }, 

24 ) 

25 assert model is not None 

26 assert model.bigints == [538075535121842179] 

27 

28 model = client.lists.update( 

29 where={ 

30 'id': models[1].id, 

31 }, 

32 data={ 

33 'bigints': { 

34 'push': [186214420957888512], 

35 }, 

36 }, 

37 ) 

38 assert model is not None 

39 assert model.bigints == [ 

40 539506179039297536, 

41 281454500584095754, 

42 186214420957888512, 

43 ]