diff options
| author | Ian Kelly <ian.g.kelly@gmail.com> | 2007-09-14 21:38:45 +0000 |
|---|---|---|
| committer | Ian Kelly <ian.g.kelly@gmail.com> | 2007-09-14 21:38:45 +0000 |
| commit | 5a5d8a90b54e88e561b4e1e3c65c67b9307244c2 (patch) | |
| tree | a8847db6ff67fb207b421bd7b0aed3099569f292 /tests | |
| parent | 06f4c38b55f82333b195630b30c3a54a044174af (diff) | |
Added test cases for [6218].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/backends/__init__.py | 0 | ||||
| -rw-r--r-- | tests/regressiontests/backends/models.py | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/regressiontests/backends/__init__.py b/tests/regressiontests/backends/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/regressiontests/backends/__init__.py diff --git a/tests/regressiontests/backends/models.py b/tests/regressiontests/backends/models.py new file mode 100644 index 0000000000..50a628a22e --- /dev/null +++ b/tests/regressiontests/backends/models.py @@ -0,0 +1,29 @@ +from django.db import models + +class Square(models.Model): + root = models.IntegerField() + square = models.PositiveIntegerField() + + def __unicode__(self): + return "%s ** 2 == %s" % (self.root, self.square) + +__test__ = {'API_TESTS': """ + +#4896: Test cursor.executemany +>>> from django.db import connection +>>> cursor = connection.cursor() +>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)', +... [(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>] + +#4765: executemany with params=None or params=[] does nothing +>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)', None) and None or None +>>> Square.objects.count() +11 + +>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)', []) and None or None +>>> Square.objects.count() +11 + +"""} |
