1. fiji
  2. django-3k
  3. Issues
Issue #58 resolved

Cannot convert byte strings to decimal in modeltests.aggregation

Johan Harjono
created an issue

{{{

!python

====================================================================== FAIL: Doctest: modeltests.aggregation.models.test.API_TESTS


Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 2222, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for modeltests.aggregation.models.test.API_TESTS File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line unknown line number, in API_TESTS


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: Book.objects.all().annotate().order_by('pk') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[17]>", line 1, in <module> Book.objects.all().annotate().order_by('pk') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'30' to Decimal


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: books.get(pk=1).name Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[19]>", line 1, in <module> books.get(pk=1).name File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 334, in get num = len(clone) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 79, in len self._result_cache = list(self.iterator()) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'30' to Decimal


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: books.get(pk=1).mean_age Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[20]>", line 1, in <module> books.get(pk=1).mean_age File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 334, in get num = len(clone) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 79, in len self._result_cache = list(self.iterator()) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'30' to Decimal


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: sorted([(b.name, b.authorsageavg) for b in books]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[22]>", line 1, in <module> sorted([(b.name, b.authorsageavg) for b in books]) File "<doctest modeltests.aggregation.models.test.API_TESTS[22]>", line 1, in <listcomp> sorted([(b.name, b.authorsageavg) for b in books]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'23.09' to Decimal


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: sorted([(b.name, b.num_authors) for b in books]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[24]>", line 1, in <module> sorted([(b.name, b.num_authors) for b in books]) File "<doctest modeltests.aggregation.models.test.API_TESTS[24]>", line 1, in <listcomp> sorted([(b.name, b.num_authors) for b in books]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'30' to Decimal


File "/home/johan/workspace/fiji/build/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.test.API_TESTS Failed example: sorted([(b.name, b.publishernum_awardssum) for b in books]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.aggregation.models.test.API_TESTS[30]>", line 1, in <module> sorted([(b.name, b.publishernum_awardssum) for b in books]) File "<doctest modeltests.aggregation.models.test.API_TESTS[30]>", line 1, in <listcomp> sorted([(b.name, b.publishernum_awardssum) for b in books]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 672, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 117, in typecast_decimal return decimal.Decimal(s) File "/usr/lib/python3.1/decimal.py", line 654, in new__ raise TypeError("Cannot convert %r to Decimal" % value) TypeError: Cannot convert b'30' to Decimal }}}

Comments (1)

  1. Log in to comment