Ticket #5246: mssql_tests.2.patch

File mssql_tests.2.patch, 2.8 KB (added by Filip Wasilewski <filip.wasilewski@…>, 17 years ago)

Exclude regular expressions and empty model tests

  • modeltests/empty/models.py

     
    66"""
    77
    88from django.db import models
     9from django.conf import settings
    910
    1011class Empty(models.Model):
    1112    pass
    1213
    13 __test__ = {'API_TESTS':"""
     14if settings.DATABASE_ENGINE not in ('mssql',):
     15    __test__ = {'API_TESTS':"""
    1416>>> m = Empty()
    1517>>> m.id
    1618>>> m.save()
     
    2224True
    2325>>> existing = Empty(m.id)
    2426>>> existing.save()
     27"""}
    2528
    26 """}
     29else:
     30    __test__ = {'API_TESTS':""}
  • modeltests/lookup/models.py

     
    274274>>> a4.save()
    275275>>> a5 = Article(pub_date=now, headline='hey-Foo')
    276276>>> a5.save()
     277"""}
    277278
     279
     280if settings.DATABASE_ENGINE not in ('mssql',):
     281    __test__['API_TESTS'] += r"""
    278282# zero-or-more
    279283>>> Article.objects.filter(headline__regex=r'fo*')
    280284[<Article: f>, <Article: fo>, <Article: foo>, <Article: fooo>]
     
    288292# wildcard
    289293>>> Article.objects.filter(headline__regex=r'fooo?')
    290294[<Article: foo>, <Article: fooo>]
     295"""
    291296
     297
     298
     299__test__['API_TESTS'] += r"""
    292300# and some more:
    293301>>> a6 = Article(pub_date=now, headline='bar')
    294302>>> a6.save()
     
    298306>>> a8.save()
    299307>>> a9 = Article(pub_date=now, headline='baxZ')
    300308>>> a9.save()
     309"""
    301310
     311
     312if settings.DATABASE_ENGINE not in ('mssql',):
     313    __test__['API_TESTS'] += r"""
    302314# leading anchor
    303315>>> Article.objects.filter(headline__regex=r'^b')
    304316[<Article: bar>, <Article: baxZ>, <Article: baz>]
     
    318330[<Article: baxZ>]
    319331>>> Article.objects.filter(headline__iregex=r'ba[RxZ]')
    320332[<Article: bar>, <Article: baxZ>, <Article: baz>]
     333"""
    321334
     335
     336__test__['API_TESTS'] += r"""
    322337# and yet more:
    323338>>> a10 = Article(pub_date=now, headline='foobar')
    324339>>> a10.save()
     
    334349>>> a15.save()
    335350>>> a16 = Article(pub_date=now, headline='bazbaRFOO')
    336351>>> a16.save()
     352"""
    337353
     354
     355if settings.DATABASE_ENGINE not in ('mssql',):
     356    __test__['API_TESTS'] += r"""
    338357# alternation
    339358>>> Article.objects.filter(headline__regex=r'oo(f|b)')
    340359[<Article: barfoobaz>, <Article: foobar>, <Article: foobarbaz>, <Article: foobaz>]
     
    348367[<Article: barfoobaz>, <Article: baz>, <Article: bazbaRFOO>, <Article: foobarbaz>, <Article: foobaz>]
    349368>>> Article.objects.filter(headline__iregex=r'b.*ar')
    350369[<Article: bar>, <Article: barfoobaz>, <Article: bazbaRFOO>, <Article: foobar>, <Article: foobarbaz>]
    351 """}
     370"""
    352371
    353372
    354 if settings.DATABASE_ENGINE not in ('mysql', 'mysql_old'):
     373if settings.DATABASE_ENGINE not in ('mysql', 'mysql_old', 'mssql'):
    355374    __test__['API_TESTS'] += r"""
    356375# grouping and backreferences
    357376>>> Article.objects.filter(headline__regex=r'b(.).*b\1')
Back to Top