@@ -288,34 +288,44 @@ class Game(db.Model):
288288
289289
290290async def test_lookup_custom_name (bind ):
291- from gino .exceptions import NoSuchRowError
292-
293291 class ModelWithCustomColumnNames (db .Model ):
294- __tablename__ = ' gino_test_custom_column_names'
292+ __tablename__ = " gino_test_custom_column_names"
295293
296- id = db .Column (' other' , db .Integer (), primary_key = True )
294+ id = db .Column (" other" , db .Integer (), primary_key = True )
297295 field = db .Column (db .Text ())
298296
299297 await ModelWithCustomColumnNames .gino .create ()
300298
301299 try :
302300 # create
303- m1 = await ModelWithCustomColumnNames .create (id = 1 , field = 'A' )
304- m2 = await ModelWithCustomColumnNames .create (id = 2 , field = 'B' )
301+ m1 = await ModelWithCustomColumnNames .create (id = 1 , field = "A" )
302+ m2 = await ModelWithCustomColumnNames .create (id = 2 , field = "B" )
305303
306304 # update
307- uq = m1 .update (field = 'C' )
305+ uq = m1 .update (field = "C" )
308306 await uq .apply ()
309307
310308 # lookup
311- assert set (tuple (x ) for x in await ModelWithCustomColumnNames .select ('id' ).gino .all ()) == {(1 ,), (2 ,)}
309+ assert set (
310+ tuple (x ) for x in await ModelWithCustomColumnNames .select ("id" ).gino .all ()
311+ ) == {(1 ,), (2 ,)}
312312 assert (await ModelWithCustomColumnNames .get (2 )).field == "B"
313313 assert (await ModelWithCustomColumnNames .get (1 )).field == "C"
314314 assert await ModelWithCustomColumnNames .get (3 ) is None
315315
316316 # delete
317- assert (await ModelWithCustomColumnNames .delete .where (ModelWithCustomColumnNames .id == 3 ).gino .status ())[0 ][- 1 ] == '0'
318- assert (await ModelWithCustomColumnNames .delete .where (ModelWithCustomColumnNames .id == 2 ).gino .status ())[0 ][- 1 ] == '1'
319- assert set (tuple (x ) for x in await ModelWithCustomColumnNames .select ('id' ).gino .all ()) == {(1 ,)}
317+ assert (
318+ await ModelWithCustomColumnNames .delete .where (
319+ ModelWithCustomColumnNames .id == 3
320+ ).gino .status ()
321+ )[0 ][- 1 ] == "0"
322+ assert (
323+ await ModelWithCustomColumnNames .delete .where (
324+ ModelWithCustomColumnNames .id == 2
325+ ).gino .status ()
326+ )[0 ][- 1 ] == "1"
327+ assert set (
328+ tuple (x ) for x in await ModelWithCustomColumnNames .select ("id" ).gino .all ()
329+ ) == {(1 ,)}
320330 finally :
321331 await ModelWithCustomColumnNames .gino .drop ()
0 commit comments