          serializer.is_valid()
          serializer.save()
          assert serializer.data == {'included': 'abc'}
  
      def test_not_required_output_for_allow_null_field(self):
          class ExampleSerializer(serializers.Serializer):
              omitted = serializers.CharField(required=False, allow_null=True)
              included = serializers.CharField()
  
          serializer = ExampleSerializer({'included': 'abc'})
          assert 'omitted' not in serializer.data
  
  
  class TestDefaultOutput:
      def setup(self):
          class ExampleSerializer(serializers.Serializer):
              has_default = serializers.CharField(default='x')
 
</s> remove         # allow_null=True should imply default=None
 </s> add         """
        Without an explicit default, allow_null implies default=None when serializing. #5518 #5708
        """ </s> remove             if not self.required:
                raise SkipField()
 </s> add 
          serializer.is_valid()
          serializer.save()
          assert serializer.data == {'included': 'abc'}
  








  
  class TestDefaultOutput:
      def setup(self):
          class ExampleSerializer(serializers.Serializer):
              has_default = serializers.CharField(default='x')
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 Correct allow_null behaviour when required=False (#5888)

* Revert "Non-required fields with 'allow_null=True' should not imply a default value (#5639)"
    This reverts commit 905a5579dfaa717ad4210ddd285267bb9bbb9a43.
    Closes #5708

* Add test for allow_null + required=False
    Ref #5708: allow_null should imply default=None, even for non-required fields.

* Re-order allow_null and default in field docs
    default is prior to allow_null. allow_null implies an outgoing default=None.

* Adjust allow_null note. 
tests/test_serializer.py