  
          serializer = NullOKSluggedNullableForeignKeySourceSerializer(queryset)
          self.assertEquals(serializer.data, expected)
  
          serializer = SluggedNullableForeignKeySourceSerializer(queryset)
          #Throws 
          self.assertEquals(serializer.data, expected)
  
      def test_slug_foreign_key_create_with_valid_null(self):
          data = {'name': u'source-4', 'target': None}
          default_data = {'name': u'source-4', 'target': 'N/A'}
  
          serializer = SluggedNullableForeignKeySourceSerializer(data=data)
          self.assertFalse(serializer.is_valid())
          self.assertEquals(serializer.errors, {'target': [u'Value may not be null']})
  
  
          #If attribute not required, data should match
          serializer = NullOKSluggedNullableForeignKeySourceSerializer(data=data)
          self.assertTrue(serializer.is_valid())
          obj = serializer.save()
          #BUG: Throws AttributeError: "NoneType object has no attribute 'name'"
          self.assertEquals(serializer.data, data)
          self.assertEqual(obj.name, u'source-4')
  
          #If default = 'N/A' then target should pass validation, and be the default ('N/A')
          serializer = DefaultSluggedNullableForeignKeySourceSerializer(data=data)
          #BUG: test case fails
          self.assertTrue(serializer.is_valid())
          #BUG: serializer.errors = {'target': [u'Value may not be null']}
          #BUG: Serializer does not use default value to save object
          obj = serializer.save()
          #BUG: Throws AttributeError - NoneType object has no attribute 'name'
 
</s> remove         #BUG: serializer.errors = {'target': [u'Value may not be null']}
        #BUG: Serializer does not use default value to save object
 </s> add  </s> remove         #BUG: Throws AttributeError - NoneType object has no attribute 'name'
        self.assertEquals(serializer.data, data)
        self.assertEqual(obj.name, u'source-4')

        #If null = True then target should be None
        serializer = NotRequiredSluggedNullableForeignKeySourceSerializer(data=data)
        #BUG: test case fails
        self.assertTrue(serializer.is_valid())
        #BUG: serializer.errors = {'target': [u'Value may not be null']}
        #BUG: serializer does not save object (But it can because its not required)
        obj = serializer.save()
        #BUG: Throws AttributeError - NoneType object has no attribute 'name'
 </s> add  </s> remove         data = {'name': u'source-4', 'target': ''}
        expected_data = {'name': u'source-4', 'target': None}

        serializer = SluggedNullableForeignKeySourceSerializer(data=data)
        self.assertFalse(serializer.is_valid())
        self.assertEquals(serializer.errors, {'target': [u'Value may not be null']})

        serializer = NullOKSluggedNullableForeignKeySourceSerializer(data=data)
 </s> add         data = {'id': 4, 'name': u'source-4', 'target': ''}
        expected_data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data) </s> remove 
        serializer = SluggedNullableForeignKeySourceSerializer(instance, data=data)
        self.assertFalse(serializer.is_valid())
        self.assertEquals(serializer.errors, {'target': [u'Value may not be null']})

        serializer = DefaultSluggedNullableForeignKeySourceSerializer(instance, data=data)
        #BUG: is_valid() is False
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.data, default_data)
        serializer.save()

        serializer = NullOKSluggedNullableForeignKeySourceSerializer(instance, data=data)
        self.assertTrue(serializer.is_valid())
        #BUG: Throws AttributeError: 'NoneType' object has no attribute 'name'
        self.assertEquals(serializer.data, data)
        serializer.save()

        serializer = NotRequiredSluggedNullableForeignKeySourceSerializer(instance, data=data)
        #BUG: is_valid() is False
 </s> add         serializer = NullableSlugSourceSerializer(instance, data=data) </s> remove         #BUG: Throws AttributeError: 'NoneType' object has no attribute 'name'
        self.assertEquals(serializer.data, expected_data)
        self.assertEqual(obj.name, u'source-4')

        serializer = NotRequiredSluggedNullableForeignKeySourceSerializer(data=data)
        #BUG: is_valid() is False
        self.assertTrue(serializer.is_valid())
        obj = serializer.save()
        #BUG: Throws AttributeError: 'NoneType' object has no attribute 'name'
        self.assertEquals(serializer.data, expected_data)
        self.assertEqual(obj.name, u'source-4')

        serializer = DefaultSluggedNullableForeignKeySourceSerializer(data=data)
        #BUG: is_valid() is False
        self.assertTrue(serializer.is_valid())
        obj = serializer.save()
        #BUG: Throws AttributeError: 'NoneType' object has no attribute 'name'
 </s> add 
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
  
          serializer = NullOKSluggedNullableForeignKeySourceSerializer(queryset)
          self.assertEquals(serializer.data, expected)
  
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
    def test_foreign_key_create_with_valid_null(self):
        data = {'id': 4, 'name': u'source-4', 'target': None}
        serializer = NullableSlugSourceSerializer(data=data)
          self.assertTrue(serializer.is_valid())
          #BUG: serializer.errors = {'target': [u'Value may not be null']}
          #BUG: Serializer does not use default value to save object
          obj = serializer.save()
          #BUG: Throws AttributeError - NoneType object has no attribute 'name'
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Drop bits of relations_slug tests which don't mirror existing tests. 
rest_framework/tests/relations_slug.py