'Ensure error-on-delete is only thrown when waffle switch active'

def test_error_on_delete(self):

    switch = Switch.objects.create(name='wiki_error_on_delete')
    for active in (True, False):
        switch.active = active
        switch.save()
        d = document()
        d.save()
        try:
            d.delete()
            if active:
                self.fail('Exception    on    delete    when    active')
        except Exception:
            if (not active):
                self.fail('No    exception    on    delete    when    not    active')
