Ticket #2170: 2170-fix-with-test.diff

File 2170-fix-with-test.diff, 1.7 KB (added by PhiR, 7 years ago)

added a regression test

  • django/db/backends/mysql_old/base.py

     
    133133    features = DatabaseFeatures()
    134134    ops = DatabaseOperations()
    135135    operators = {
    136         'exact': '= %s',
     136        'exact': '= BINARY %s',
    137137        'iexact': 'LIKE %s',
    138138        'contains': 'LIKE BINARY %s',
    139139        'icontains': 'LIKE %s',
  • django/db/backends/mysql/base.py

     
    128128    features = DatabaseFeatures()
    129129    ops = DatabaseOperations()
    130130    operators = {
    131         'exact': '= %s',
     131        'exact': '= BINARY %s',
    132132        'iexact': 'LIKE %s',
    133133        'contains': 'LIKE BINARY %s',
    134134        'icontains': 'LIKE %s',
  • tests/regressiontests/string_lookup/models.py

     
    9797>>> Article.objects.get(text__exact='The quick brown fox jumps over the lazy dog.')
    9898<Article: Article Test>
    9999
     100# Regression tests for #2170: test case sensitiveness
     101>>> Article.objects.filter(text__exact='tHe qUick bRown fOx jUmps over tHe lazy dog.')
     102[]
     103>>> Article.objects.filter(text__iexact='tHe qUick bRown fOx jUmps over tHe lazy dog.')
     104[<Article: Article Test>]
     105
    100106>>> Article.objects.get(text__contains='quick brown fox')
    101107<Article: Article Test>
    102108
Back to Top