@@ -24,7 +24,9 @@ async def test_crud(bind):
24
24
25
25
now = datetime .utcnow ()
26
26
now_str = now .strftime (DATETIME_FORMAT )
27
- u = await User .create (nickname = "fantix" , birthday = now , bio = "I code in Python and more." )
27
+ u = await User .create (
28
+ nickname = "fantix" , birthday = now , bio = "I code in Python and more."
29
+ )
28
30
u .age += 1
29
31
assert await u .query .gino .model (None ).first () == (
30
32
1 ,
@@ -69,7 +71,12 @@ async def test_crud(bind):
69
71
# Reload and test updating both JSON and regular property
70
72
u = await User .get (u .id )
71
73
await u .update (
72
- age = User .age - 2 , balance = 200.15 , realname = "daisy" , nickname = "daisy.nick" , height = 185 , weight = 75
74
+ age = User .age - 2 ,
75
+ balance = 200.15 ,
76
+ realname = "daisy" ,
77
+ nickname = "daisy.nick" ,
78
+ height = 185 ,
79
+ weight = 75 ,
73
80
).apply ()
74
81
data = await u .query .gino .model (None ).first ()
75
82
assert await u .query .gino .model (None ).first () == (
@@ -91,7 +98,7 @@ async def test_crud(bind):
91
98
team_id = None ,
92
99
bio = "I code in Python and more." ,
93
100
height = 185 ,
94
- weight = 75
101
+ weight = 75 ,
95
102
)
96
103
97
104
# Deleting property doesn't affect database
@@ -168,10 +175,10 @@ class PropsTest(db.Model):
168
175
169
176
parameter = db .Column (JSONB (), nullable = False , server_default = "{}" )
170
177
171
- raw_param = db .JSONProperty (prop_name = ' parameter' )
172
- bool_param = db .BooleanProperty (prop_name = ' parameter' )
173
- obj_param = db .ObjectProperty (prop_name = ' parameter' )
174
- arr_param = db .ArrayProperty (prop_name = ' parameter' )
178
+ raw_param = db .JSONProperty (prop_name = " parameter" )
179
+ bool_param = db .BooleanProperty (prop_name = " parameter" )
180
+ obj_param = db .ObjectProperty (prop_name = " parameter" )
181
+ arr_param = db .ArrayProperty (prop_name = " parameter" )
175
182
176
183
await PropsTest .gino .create ()
177
184
try :
@@ -180,7 +187,6 @@ class PropsTest(db.Model):
180
187
bool = True ,
181
188
obj = dict (x = 1 , y = 2 ),
182
189
arr = [3 , 4 , 5 , 6 ],
183
-
184
190
raw_param = dict (a = [3 , 4 ]),
185
191
bool_param = False ,
186
192
obj_param = dict (x = 3 , y = 4 ),
@@ -191,10 +197,22 @@ class PropsTest(db.Model):
191
197
assert t .arr [- 1 ] == 6
192
198
assert t .arr_param [- 1 ] == 10
193
199
data = await db .select (
194
- [PropsTest .profile , PropsTest .parameter , PropsTest .raw , PropsTest .bool , PropsTest .obj_param ]
200
+ [
201
+ PropsTest .profile ,
202
+ PropsTest .parameter ,
203
+ PropsTest .raw ,
204
+ PropsTest .bool ,
205
+ PropsTest .obj_param ,
206
+ ]
195
207
).gino .first ()
196
208
assert await db .select (
197
- [PropsTest .profile , PropsTest .parameter , PropsTest .raw , PropsTest .bool , PropsTest .obj_param ]
209
+ [
210
+ PropsTest .profile ,
211
+ PropsTest .parameter ,
212
+ PropsTest .raw ,
213
+ PropsTest .bool ,
214
+ PropsTest .obj_param ,
215
+ ]
198
216
).gino .first () == (
199
217
{
200
218
"arr" : [3 , 4 , 5 , 6 ],
0 commit comments