Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revert "Fixed #20462 - Fixed sqlite regex lookups for null values and…

… non-string fields."

This reverts commit 64041f0.

lookup.tests.LookupTests.test_regex_non_string fails under Postgres.
We should also try to rewrite the test using an existing model.
  • Loading branch information...
commit 92c49d6f01700961698eb3d79fd393d673cee219 1 parent 78974ed
Tim Graham authored June 11, 2013
1  AUTHORS
@@ -270,7 +270,6 @@ answer newbie questions, and generally made Django that much better:
270 270
     Brian Harring <ferringb@gmail.com>
271 271
     Brant Harris
272 272
     Ronny Haryanto <http://ronny.haryan.to/>
273  
-    Axel Haustant <noirbizarre@gmail.com>
274 273
     Hawkeye
275 274
     Kent Hauser <kent@khauser.net>
276 275
     Joe Heck <http://www.rhonabwy.com/wp/>
2  django/db/backends/sqlite3/base.py
@@ -519,4 +519,4 @@ def _sqlite_format_dtdelta(dt, conn, days, secs, usecs):
519 519
     return str(dt)
520 520
 
521 521
 def _sqlite_regexp(re_pattern, re_string):
522  
-    return bool(re.search(re_pattern, str(re_string))) if re_string is not None else False
  522
+    return bool(re.search(re_pattern, re_string))
9  tests/lookup/models.py
@@ -57,12 +57,3 @@ class Player(models.Model):
57 57
 
58 58
     def __str__(self):
59 59
         return self.name
60  
-
61  
-
62  
-@python_2_unicode_compatible
63  
-class RegexTestModel(models.Model):
64  
-    name = models.CharField(max_length=100, null=True)
65  
-    integer = models.IntegerField(null=True)
66  
-
67  
-    def __str__(self):
68  
-        return self.name
17  tests/lookup/tests.py
@@ -6,7 +6,7 @@
6 6
 from django.core.exceptions import FieldError
7 7
 from django.test import TestCase, skipUnlessDBFeature
8 8
 
9  
-from .models import Author, Article, Tag, Game, Season, Player, RegexTestModel
  9
+from .models import Author, Article, Tag, Game, Season, Player
10 10
 
11 11
 
12 12
 class LookupTests(TestCase):
@@ -610,21 +610,6 @@ def test_regex_backreferencing(self):
610 610
         self.assertQuerysetEqual(Article.objects.filter(headline__regex=r'b(.).*b\1'),
611 611
             ['<Article: barfoobaz>', '<Article: bazbaRFOO>', '<Article: foobarbaz>'])
612 612
 
613  
-    def test_regex_null(self):
614  
-        """
615  
-        Ensure that a regex lookup does not fail on null/None values
616  
-        """
617  
-        RegexTestModel.objects.create(name=None)
618  
-        self.assertQuerysetEqual(RegexTestModel.objects.filter(name__regex=r'^$'), [])
619  
-
620  
-    def test_regex_non_string(self):
621  
-        """
622  
-        Ensure that a regex lookup does not fail on non-string fields
623  
-        """
624  
-        RegexTestModel.objects.create(name='test', integer=5)
625  
-        self.assertQuerysetEqual(RegexTestModel.objects.filter(integer__regex=r'^5$'),
626  
-            ['<RegexTestModel: test>'])
627  
-
628 613
     def test_nonfield_lookups(self):
629 614
         """
630 615
         Ensure that a lookup query containing non-fields raises the proper

0 notes on commit 92c49d6

Please sign in to comment.
Something went wrong with that request. Please try again.