diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2008-08-11 12:11:25 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2008-08-11 12:11:25 +0000 |
| commit | 9dc4ba875f21d5690f6ad5995123a67a3c44bafe (patch) | |
| tree | 621f876758ac16dceee95faf51973d4b05f1c830 /tests | |
| parent | cec69eb70d1e2f84dc5a7fb172da88a79b0f5063 (diff) | |
Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/backends/models.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/regressiontests/backends/models.py b/tests/regressiontests/backends/models.py index a041ab6b12..61b7b1af73 100644 --- a/tests/regressiontests/backends/models.py +++ b/tests/regressiontests/backends/models.py @@ -15,10 +15,6 @@ class Person(models.Model): def __unicode__(self): return u'%s %s' % (self.first_name, self.last_name) -if connection.features.uses_case_insensitive_names: - t_convert = lambda x: x.upper() -else: - t_convert = lambda x: x qn = connection.ops.quote_name __test__ = {'API_TESTS': """ @@ -29,7 +25,7 @@ __test__ = {'API_TESTS': """ >>> opts = Square._meta >>> f1, f2 = opts.get_field('root'), opts.get_field('square') >>> query = ('INSERT INTO %s (%s, %s) VALUES (%%s, %%s)' -... % (t_convert(opts.db_table), qn(f1.column), qn(f2.column))) +... % (connection.introspection.table_name_converter(opts.db_table), qn(f1.column), qn(f2.column))) >>> cursor.executemany(query, [(i, i**2) for i in range(-5, 6)]) and None or None >>> Square.objects.order_by('root') [<Square: -5 ** 2 == 25>, <Square: -4 ** 2 == 16>, <Square: -3 ** 2 == 9>, <Square: -2 ** 2 == 4>, <Square: -1 ** 2 == 1>, <Square: 0 ** 2 == 0>, <Square: 1 ** 2 == 1>, <Square: 2 ** 2 == 4>, <Square: 3 ** 2 == 9>, <Square: 4 ** 2 == 16>, <Square: 5 ** 2 == 25>] @@ -48,7 +44,7 @@ __test__ = {'API_TESTS': """ >>> opts2 = Person._meta >>> f3, f4 = opts2.get_field('first_name'), opts2.get_field('last_name') >>> query2 = ('SELECT %s, %s FROM %s ORDER BY %s' -... % (qn(f3.column), qn(f4.column), t_convert(opts2.db_table), +... % (qn(f3.column), qn(f4.column), connection.introspection.table_name_converter(opts2.db_table), ... qn(f3.column))) >>> cursor.execute(query2) and None or None >>> cursor.fetchone() |
