summaryrefslogtreecommitdiff
path: root/tests/backends
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2013-09-06 12:18:16 -0400
committerTim Graham <timograham@gmail.com>2013-09-06 12:31:17 -0400
commiteade315da1c8372ac1dfcf1fd20ea87f454d71ac (patch)
tree8eeb30580f8ca4a00d2a776e65b88288887f95da /tests/backends
parent630eb0564abd228da439d86ad93acb4089d795e7 (diff)
Fixed #10164 -- Made AutoField increase monotonically on SQLite
Thanks malte for the report.
Diffstat (limited to 'tests/backends')
-rw-r--r--tests/backends/tests.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index e00cdf94ce..25df8ea139 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import datetime
from decimal import Decimal
+import re
import threading
import unittest
@@ -108,6 +109,25 @@ class OracleChecks(unittest.TestCase):
self.assertEqual(c.fetchone()[0], 1)
+class SQLiteTests(TestCase):
+ longMessage = True
+
+ @unittest.skipUnless(connection.vendor == 'sqlite',
+ "Test valid only for SQLite")
+ def test_autoincrement(self):
+ """
+ Check that auto_increment fields are created with the AUTOINCREMENT
+ keyword in order to be monotonically increasing. Refs #10164.
+ """
+ statements = connection.creation.sql_create_model(models.Square,
+ style=no_style())
+ match = re.search('"id" ([^,]+),', statements[0][0])
+ self.assertIsNotNone(match)
+ self.assertEqual('integer NOT NULL PRIMARY KEY AUTOINCREMENT',
+ match.group(1), "Wrong SQL used to create an auto-increment "
+ "column on SQLite")
+
+
class MySQLTests(TestCase):
@unittest.skipUnless(connection.vendor == 'mysql',
"Test valid only for MySQL")