#NEWLINE# def test_empty_not_allowed_if_allow_empty_is_set_to_false( self ) : #NEWLINE# #INDENT# input_data = { #NEWLINE# #INDENT# 'allow_null' : [ { #NEWLINE# #INDENT# 'example' : '2' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'not_allow_null' : [ { #NEWLINE# #INDENT# 'example' : '2' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'allow_empty' : [ ] , #NEWLINE# 'not_allow_empty' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# serializer = self . Serializer ( data = serializer ) #NEWLINE# assert ( not serializer . is_valid ( ) ) #NEWLINE# expected_errors = { #NEWLINE# #INDENT# 'not_allow_empty' : { #NEWLINE# #INDENT# 'non_field_errors' : [ serializers . ListSerializer . default_error_messages [ 'empty' ] ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# assert ( serializer . errors == expected_errors )