          assert serializer.data == self.data
  
  
  class TestIncorrectlyConfigured:
      def test_incorrect_field_name(self):
          class ExampleSerializer(serializers.Serializer):
              incorrect_name = serializers.IntegerField()
  
 
</s> remove         class TestSerializer(serializers.Serializer):
 </s> add         class NestedBaseSerializer(serializers.Serializer): </s> remove         self.Serializer = TestSerializer
 </s> add         # nullable nested serializer testing
        class NullableNestedSerializer(serializers.Serializer):
            nested = NestedSerializer1(source='*', allow_null=True)

        # nullable custom field testing
        class CustomField(serializers.Field):
            def to_representation(self, instance):
                return getattr(instance, 'foo', None)

            def to_internal_value(self, data):
                return {'foo': data}

        class NullableFieldSerializer(serializers.Serializer):
            field = CustomField(source='*', allow_null=True)

        self.Serializer = NestedBaseSerializer
        self.NullableNestedSerializer = NullableNestedSerializer
        self.NullableFieldSerializer = NullableFieldSerializer </s> remove     Tests for `source='*'` argument, which is used for nested representations.
 </s> add     Tests for `source='*'` argument, which is often used for complex field or
    nested representations.
    def test_field_validate(self):
        serializer = self.NullableFieldSerializer(data={'field': 'bar'})

        # validation should pass since no internal validation
        assert serializer.is_valid()
        assert serializer.validated_data == {'foo': 'bar'}

    def test_field_null_validate(self):
        serializer = self.NullableFieldSerializer(data={'field': None})

        # validation should pass since no internal validation
        assert serializer.is_valid()
        assert serializer.validated_data == {'foo': None}

          assert serializer.data == self.data
  
    def test_field_validate(self):
        serializer = self.NullableFieldSerializer(data={'field': 'bar'})

        # validation should pass since no internal validation
        assert serializer.is_valid()
        assert serializer.validated_data == {'foo': 'bar'}

    def test_field_null_validate(self):
        serializer = self.NullableFieldSerializer(data={'field': None})

        # validation should pass since no internal validation
        assert serializer.is_valid()
        assert serializer.validated_data == {'foo': None}

  
  class TestIncorrectlyConfigured:
      def test_incorrect_field_name(self):
          class ExampleSerializer(serializers.Serializer):
              incorrect_name = serializers.IntegerField()
  
keep add keep keep keep keep keep keep
 Fix nullable `source='*'` fields (#6659) 
tests/test_serializer.py