#NEWLINE# @ pytest . mark . parametrize ( 'kwargs, to_sql' , [ ( { #NEWLINE# #INDENT# 'max_length' : 10 , #NEWLINE# #UNINDENT# } , 'field_name varchar(10)' ) , ( { #NEWLINE# #INDENT# 'server_default' : "''" , #NEWLINE# #UNINDENT# } , "field_name varchar DEFAULT ''" ) , ( { #NEWLINE# #INDENT# 'unique' : True , #NEWLINE# #UNINDENT# } , 'field_name varchar UNIQUE' ) , ( { #NEWLINE# #INDENT# 'nullable' : False , #NEWLINE# #UNINDENT# } , 'field_name varchar NOT NULL' ) , ( { #NEWLINE# #INDENT# 'primary_key' : True , #NEWLINE# #UNINDENT# } , 'field_name varchar PRIMARY KEY' ) , ( { #NEWLINE# #INDENT# 'foreign_key' : orm . ForeignKey ( 'users.id' ) , #NEWLINE# #UNINDENT# } , 'field_name varchar REFERENCES users (id)' ) ] ) #NEWLINE# def test_field_option( model , kwargs , to_sql ) : #NEWLINE# #INDENT# field = orm . CharField ( name = 'field_name' , ** kwargs ) #NEWLINE# assert ( field . to_sql ( ) == to_sql )