File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -203,10 +203,22 @@ def tearDown(self):
203203 Ticket .alter ().drop_table ().run_sync ()
204204
205205 def test_set_digits (self ):
206+ query = """
207+ SELECT numeric_precision, numeric_scale
208+ FROM information_schema.columns
209+ WHERE table_name = 'ticket'
210+ AND table_catalog = 'piccolo'
211+ AND column_name = 'price'
212+ """
213+
206214 Ticket .alter ().set_digits (
207215 column = Ticket .price , digits = (6 , 2 )
208216 ).run_sync ()
209-
210- Ticket .insert (Ticket (price = decimal .Decimal ("9999.00" ))).run_sync ()
211- ticket = Ticket .objects ().first ().run_sync ()
212- self .assertTrue (ticket .price == decimal .Decimal ("9999.00" ))
217+ response = Ticket .raw (query ).run_sync ()
218+ self .assertTrue (response [0 ]["numeric_precision" ] == 6 )
219+ self .assertTrue (response [0 ]["numeric_scale" ] == 2 )
220+
221+ Ticket .alter ().set_digits (column = Ticket .price , digits = None ).run_sync ()
222+ response = Ticket .raw (query ).run_sync ()
223+ self .assertTrue (response [0 ]["numeric_precision" ] == None )
224+ self .assertTrue (response [0 ]["numeric_scale" ] == None )
You can’t perform that action at this time.
0 commit comments