def test_logic(self):
        person = Person(name="Chris Beaven", country="NZ")

        self.assertEqual(person.country, "NZ")
        self.assertNotEqual(person.country, "ZZ")

        self.assertTrue(person.country)
        person.country = ""
        self.assertFalse(person.country)
    def test_logic(self):
        person = Person(name='Chris Beaven', country='NZ')

        self.assertEqual(person.country, 'NZ')
        self.assertNotEqual(person.country, 'ZZ')

        self.assertTrue(person.country)
        person.country = ''
        self.assertFalse(person.country)
 def test_name(self):
     person = Person(name='Chris Beaven', fantasy_country='NV')
     self.assertEqual(person.fantasy_country.name, 'Neverland')
 def test_validate_empty(self):
     person = Person(name='Chris')
     self.assertRaises(validators.ValidationError, person.full_clean)
 def test_validate_invalid(self):
     person = Person(name='Chris', country=':(')
     self.assertRaises(validators.ValidationError, person.full_clean)
Exemple #6
0
    def test_len(self):
        person = Person(name="Chris Beaven", country="NZ")
        self.assertEqual(len(person.country), 2)

        person = Person(name="The Outsider", country=None)
        self.assertEqual(len(person.country), 0)
Exemple #7
0
 def test_render_modelform_instance(self):
     person = Person(country="NZ")
     self.Form(instance=person).as_p()
 def test_flag_css(self):
     person = Person(name='Chris Beaven', country='NZ')
     self.assertEqual(person.country.flag_css, 'flag-sprite flag-n flag-_z')
 def test_name(self):
     person = Person(name='Chris Beaven', country='NZ')
     self.assertEqual(person.country.name, 'New Zealand')
Exemple #10
0
 def test_custom_field_flag_url(self):
     person = Person(name="Chris Beaven", country="NZ", other_country="US")
     self.assertEqual(person.other_country.flag,
                      "//flags.example.com/us.gif")
Exemple #11
0
 def test_unicode_flags(self):
     person = Person(name="Matthew Schinckel",
                     country="AU",
                     other_country="DE")
     self.assertEqual(person.country.unicode_flag, "🇦🇺")
     self.assertEqual(person.other_country.unicode_flag, "🇩🇪")
Exemple #12
0
 def test_name(self):
     person = Person(name="Chris Beaven", country="NZ")
     self.assertEqual(person.country.name, "New Zealand")
Exemple #13
0
 def test_flag(self):
     person = Person(name="Chris Beaven", country="NZ")
     with self.settings(STATIC_URL="/static-assets/"):
         self.assertEqual(person.country.flag,
                          "/static-assets/flags/nz.gif")
Exemple #14
0
 def test_text(self):
     person = Person(name="Chris Beaven", country="NZ")
     self.assertEqual(force_str(person.country), "NZ")
Exemple #15
0
 def test_name(self):
     person = Person(name="Chris Beaven", fantasy_country="NV")
     self.assertEqual(person.fantasy_country.name, "Neverland")
Exemple #16
0
 def test_validate_alpha3(self):
     person = Person(name="Chris", country="NZL")
     person.full_clean()
 def test_unicode_flags(self):
     person = Person(
         name='Matthew Schinckel', country='AU', other_country='DE')
     self.assertEqual(person.country.unicode_flag, '🇦🇺')
     self.assertEqual(person.other_country.unicode_flag, '🇩🇪')
Exemple #18
0
 def test_flag_css(self):
     person = Person(name="Chris Beaven", country="NZ")
     self.assertEqual(person.country.flag_css, "flag-sprite flag-n flag-_z")
 def test_unicode_flag_blank(self):
     person = Person(name='Matthew Schinckel')
     self.assertEqual(person.country.unicode_flag, '')
 def test_custom_field_flag_url(self):
     person = Person(name='Chris Beaven', country='NZ', other_country='US')
     self.assertEqual(person.other_country.flag,
                      '//flags.example.com/us.gif')
 def test_flag_css_blank(self):
     person = Person(name='Chris Beaven')
     self.assertEqual(person.country.flag_css, '')
Exemple #22
0
 def test_text(self):
     person = Person(name='Chris Beaven', country='NZ')
     self.assertEqual(force_text(person.country), 'NZ')
 def test_flag(self):
     person = Person(name='Chris Beaven', country='NZ')
     with self.settings(STATIC_URL='/static-assets/'):
         self.assertEqual(person.country.flag,
                          '/static-assets/flags/nz.gif')
Exemple #24
0
 def test_custom_field_str_attr(self):
     person = Person(name="Quentin Coumes",
                     country="FR",
                     str_attr_country="ES")
     self.assertEqual(str(person.str_attr_country), "Spain")
    def test_len(self):
        person = Person(name='Chris Beaven', country='NZ')
        self.assertEqual(len(person.country), 2)

        person = Person(name='The Outsider', country=None)
        self.assertEqual(len(person.country), 0)
 def test_validate_alpha3(self):
     person = Person(name="Chris", country="NZL")
     person.full_clean()
 def test_validate(self):
     person = Person(name='Chris', country='NZ')
     person.full_clean()
Exemple #28
0
 def test_flag(self):
     person = Person(name='Chris Beaven', country='NZ')
     self.assertEqual(person.country.flag, '/static-assets/flags/nz.gif')