Ejemplo n.º 1
0
    def test_blank_choice(self):
        blank = ("", "---------")

        form = forms.PersonForm()
        self.assertEqual(form.fields["country"].choices[0], blank)

        multi_form = forms.MultiCountryForm()
        self.assertNotEqual(multi_form.fields["countries"].choices[0], blank)
Ejemplo n.º 2
0
    def test_blank_choice(self):
        blank = ('', '---------')

        form = forms.PersonForm()
        self.assertEqual(form.fields['country'].choices[0], blank)

        multi_form = forms.MultiCountryForm()
        self.assertNotEqual(multi_form.fields['countries'].choices[0], blank)
Ejemplo n.º 3
0
 def test_translated_choices(self):
     lang = translation.get_language()
     translation.activate("eo")
     form = forms.PersonForm()
     try:
         # This is just to prove that the language changed.
         self.assertEqual(list(countries)[0][1], "Afganio")
         # If the choices aren't lazy, this wouldn't be translated. It's the
         # second choice because the first one is the initial blank option.
         self.assertEqual(form.fields["country"].choices[1][1], "Afganio")
         self.assertEqual(form.fields["country"].widget.choices[1][1], "Afganio")
     finally:
         translation.activate(lang)
Ejemplo n.º 4
0
 def test_no_blank_choice(self):
     form = forms.PersonForm()
     self.assertEqual(form.fields["favourite_country"].choices[0],
                      ("AF", "Afghanistan"))
Ejemplo n.º 5
0
 def test_no_blank_choice(self):
     form = forms.PersonForm()
     self.assertEqual(form.fields['favourite_country'].choices[0],
                      ('AF', 'Afghanistan'))
Ejemplo n.º 6
0
 def test_blank_choice(self):
     form = forms.PersonForm()
     self.assertEqual(form.fields['country'].choices[0], ('', '---------'))