Ticket #7789: 7789_tests_3.diff

File 7789_tests_3.diff, 1.5 KB (added by arne, 16 years ago)

Some more tests for 7789_fields_3.diff

  • regressiontests/model_regress/models.py

     
    3232class Event(models.Model):
    3333    when = models.DateTimeField()
    3434
     35# #7789
     36class Julian(models.Model):
     37    name = models.CharField(max_length=20, unique=True)
     38
     39class Julian2(models.Model):
     40    slug = models.SlugField(unique=True)
     41   
    3542__test__ = {'API_TESTS': """
    3643(NOTE: Part of the regression test here is merely parsing the model
    3744declaration. The verbose_name, in particular, did not always work.)
     
    8794datetime.datetime(2000, 1, 1, 13, 1, 1)
    8895>>> e.get_previous_by_when().when
    8996datetime.datetime(2000, 1, 1, 6, 1, 1)
     97
     98
     99# #7789 MySQL case-insensitive unique constraints
     100# The follwing tests require that settings.TEST_DATABASE_CHARSET
     101# is set to 'utf8' for mysql.
     102>>> Julian.objects.get_or_create(name='Julian')[1]
     103True
     104>>> n, c = Julian.objects.get_or_create(name='julian')
     105>>> c
     106True
     107>>> n.name
     108'julian'
     109>>> Julian2.objects.get_or_create(slug='Julian')[1]
     110True
     111>>> n, c = Julian2.objects.get_or_create(slug=u'julian')
     112>>> c
     113True
     114>>> n.slug
     115u'julian'
     116>>> n, c = Julian.objects.get_or_create(name=u'\xf6')
     117>>> c
     118True
     119>>> n.name == u'\xf6'
     120True
     121>>> n, c = Julian.objects.get_or_create(name=u'\xf6')
     122>>> c
     123False
     124>>> n, c = Julian.objects.get_or_create(name=u'\xd6')
     125>>> c
     126True
     127>>> n.name == u'\xd6'
     128True
    90129"""
    91130}
Back to Top