

def test_formset_instance(self):
    request = get_request()
    (the_instance1, created) = User.objects.get_or_create(username='testuser1')
    (the_instance2, created) = User.objects.get_or_create(username='testuser2')
    testform = TestWizard.as_view([('start', UserFormSet), ('step2', Step2)], instance_dict={
        'start': User.objects.filter(username='testuser1'),
    })
    (response, instance) = testform(request)
    self.assertEqual(list(instance.get_form_instance('start')), [the_instance1])
    self.assertEqual(instance.get_form_instance('non_exist_instance'), None)
    response.assertEqual(instance.get_form().initial_form_count(), 1)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/formtools/tests/wizard/forms.py FormTests.test_formset_instance/VarMisuse@135/193 `self`->`response`