From 5ce2e6c2c827cf877f73bf0e42e6afb7e6a71ccf Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 15 Sep 2007 21:42:51 +0000 Subject: queryset-refactor: Merged to [6220] git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6337 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/backends/models.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/regressiontests/backends/models.py (limited to 'tests/regressiontests/backends/models.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') +[, , , , , , , , , , ] + +#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 + +"""} -- cgit v1.3