#12239: Float is rounded to integer on queries on integer field
---------------------------------------------------+------------------------
Reporter: waverider | Owner: kmtracey
Status: reopened | Milestone: 1.2
Component: Database layer (models, ORM) | Version: 1.1
Resolution: | Keywords: __gte,
__lte, query rounding
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by kmtracey):
* status: closed => reopened
* resolution: fixed =>
Comment:
Fix here broke some other tests:
{{{
======================================================================
ERROR: test_limits
(regressiontests.model_fields.tests.BigIntegerFieldTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/tests/regressiontests/model_fields/tests.py",
line 250, in test_limits
self.assertEqual(qs.count(), 1)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/query.py", line 324,
in count
return self.query.get_count(using=self.db)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/query.py", line
366, in get_count
number = obj.get_aggregation(using=using)[None]
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/query.py", line
338, in get_aggregation
result = query.get_compiler(using).execute_sql(SINGLE)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/compiler.py",
line 729, in execute_sql
cursor.execute(sql, params)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/backends/sqlite3/base.py",
line 197, in execute
return Database.Cursor.execute(self, query, params)
OverflowError: long too big to convert
======================================================================
FAIL: Doctest: modeltests.order_with_respect_to.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/test/_doctest.py", line 2180,
in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
modeltests.order_with_respect_to.models.__test__.API_TESTS
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/tests/modeltests/order_with_respect_to/models.py",
line unknown line number, in API_TESTS
----------------------------------------------------------------------
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite/django-
trunk_ubuntu9.10-py2.4-sqlite/build/tests/modeltests/order_with_respect_to/models.py",
line ?, in modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
a4.get_previous_in_order()
Exception raised:
Traceback (most recent call last):
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-trunk_ubuntu9.10-py2.4-sqlite/build/django/test/_doctest.py", line
1267, in __run
compileflags, 1) in test.globs
File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[17]>", line 1,
in ?
a4.get_previous_in_order()
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-trunk_ubuntu9.10-py2.4-sqlite/build/django/utils/functional.py",
line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/base.py",
line 660, in _get_next_or_previous_in_order
obj = self._default_manager.filter(**{
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/query.py",
line 545, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/query.py",
line 563, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/query.py", line
1103, in add_q
can_reuse=used_aliases)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/query.py", line
1043, in add_filter
connector)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/where.py", line
66, in add
value = obj.prepare(lookup_type, value)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/sql/where.py", line
275, in prepare
return self.field.get_prep_lookup(lookup_type, value)
File "/home/buildbot/slave-py2.4/parts/ubuntu9.10-py2.4-sqlite
/django-
trunk_ubuntu9.10-py2.4-sqlite/build/django/db/models/fields/__init__.py",
line 888, in get_prep_lookup
value = math.ceil(value)
TypeError: a float is required
----------------------------------------------------------------------
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/12239#comment:13>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.