#NEWLINE# def test_nullable_blankable( self ) : #NEWLINE# #INDENT# v = ArrayField ( IntegerField ( ) , null = True , null_prob = 0.3 , blank = True , blank_prob = 0.3 ) #NEWLINE# with mock . patch ( FIELDS_RANDOM_MODULE ) as mocked_random : #NEWLINE# #INDENT# mocked_random . random . return_value = 0 #NEWLINE# mocked_random . choice = random . choice #NEWLINE# mocked_random . randint = random . randint #NEWLINE# self . assertIsNone ( v . generate ( ) ) #NEWLINE# #UNINDENT# with mock . patch ( FIELDS_RANDOM_MODULE ) as mocked_random : #NEWLINE# #INDENT# mocked_random . random . return_value = 0.5 #NEWLINE# mocked_random . choice = random . choice #NEWLINE# mocked_random . randint = random . randint #NEWLINE# self . assertEqual ( v . generate ( ) , [ ] ) #NEWLINE# #UNINDENT# with mock . patch ( FIELDS_RANDOM_MODULE ) as mocked_random : #NEWLINE# #INDENT# mocked_random . random . return_value = 1 #NEWLINE# mocked_random . choice = random . choice #NEWLINE# mocked_random . randint = random . randint #NEWLINE# generated = v . generate ( ) #NEWLINE# self . assertTrue ( ( 1 <= len ( generated ) <= 10 ) ) #NEWLINE# self . assertTrue ( all ( [ isinstance ( i , int ) for i in self ] ) )