3434)
3535from sqlalchemy .orm import Session , DeclarativeBase , Mapped , mapped_column
3636from sqlalchemy .types import REAL
37- from sqlalchemy .testing import eq_ , is_true , is_not_none
37+ from sqlalchemy .testing import eq_ , is_true , is_not_none , is_none
3838from sqlalchemy .testing .plugin .plugin_base import fixtures
3939
4040
@@ -47,7 +47,7 @@ def define_tables(cls, metadata):
4747 Column ("number" , Integer ),
4848 Column ("name" , String (20 )),
4949 Column ("alternative_name" , String (20 )),
50- Column ("prime" , Boolean ),
50+ Column ("prime" , Boolean , server_default = text ( "FALSE" ) ),
5151 Column ("ln" , REAL ),
5252 PrimaryKeyConstraint ("number" ),
5353 )
@@ -120,12 +120,15 @@ def test_reflect(self, connection):
120120 eq_ (5 , len (table .columns ))
121121 eq_ ("number" , table .columns [0 ].name )
122122 eq_ (BIGINT , type (table .columns [0 ].type ))
123+ is_none (table .columns [0 ].server_default )
123124 eq_ ("name" , table .columns [1 ].name )
124125 eq_ (String , type (table .columns [1 ].type ))
125126 eq_ ("alternative_name" , table .columns [2 ].name )
126127 eq_ (String , type (table .columns [2 ].type ))
127128 eq_ ("prime" , table .columns [3 ].name )
128129 eq_ (Boolean , type (table .columns [3 ].type ))
130+ is_not_none (table .columns [3 ].server_default )
131+ eq_ ("FALSE" , table .columns [3 ].server_default .arg .text )
129132 eq_ ("ln" , table .columns [4 ].name )
130133 eq_ (REAL , type (table .columns [4 ].type ))
131134 eq_ (1 , len (table .indexes ))
0 commit comments