Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added test cases for [6218].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5a5d8a90b54e88e561b4e1e3c65c67b9307244c2 1 parent 06f4c38
Ian Kelly authored September 14, 2007
0  tests/regressiontests/backends/__init__.py
No changes.
29  tests/regressiontests/backends/models.py
... ...
@@ -0,0 +1,29 @@
  1
+from django.db import models
  2
+
  3
+class Square(models.Model):
  4
+    root = models.IntegerField()
  5
+    square = models.PositiveIntegerField()
  6
+
  7
+    def __unicode__(self):
  8
+        return "%s ** 2 == %s" % (self.root, self.square)
  9
+
  10
+__test__ = {'API_TESTS': """
  11
+
  12
+#4896: Test cursor.executemany
  13
+>>> from django.db import connection
  14
+>>> cursor = connection.cursor()
  15
+>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)',
  16
+...                    [(i, i**2) for i in range(-5, 6)]) and None or None
  17
+>>> Square.objects.order_by('root')
  18
+[<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>]
  19
+
  20
+#4765: executemany with params=None or params=[] does nothing
  21
+>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)', None) and None or None
  22
+>>> Square.objects.count()
  23
+11
  24
+
  25
+>>> cursor.executemany('INSERT INTO BACKENDS_SQUARE (ROOT, SQUARE) VALUES (%s, %s)', []) and None or None
  26
+>>> Square.objects.count()
  27
+11
  28
+
  29
+"""}

0 notes on commit 5a5d8a9

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