              'd': 4
          }
  
      def test_nested_serialize(self):
          """
          An object can be serialized into a nested representation.
          """
          instance = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
 
</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         class TestSerializer(serializers.Serializer):
 </s> add         class NestedBaseSerializer(serializers.Serializer): </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_nested_null_validate(self):
        serializer = self.NullableNestedSerializer(data={'nested': None})

        # validation should fail (but not error) since nested fields are required
        assert not serializer.is_valid()

              'd': 4
          }
  
    def test_nested_null_validate(self):
        serializer = self.NullableNestedSerializer(data={'nested': None})

        # validation should fail (but not error) since nested fields are required
        assert not serializer.is_valid()

      def test_nested_serialize(self):
          """
          An object can be serialized into a nested representation.
          """
          instance = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
keep keep add keep keep keep keep keep
 Fix nullable `source='*'` fields (#6659) 
tests/test_serializer.py