Various errors in modeltests.custom_pk
{{{
!python
====================================================================== FAIL: Doctest: modeltests.custom_pk.models.test.API_TESTS
Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 2234, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for modeltests.custom_pk.models.test.API_TESTS File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line unknown line number, in API_TESTS
File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line ?, in modeltests.custom_pk.models.test.API_TESTS Failed example: new_bar = Bar.objects.create() 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.custom_pk.models.test__.API_TESTS[36]>", line 1, in <module> new_bar = Bar.objects.create() File "/usr/local/lib/python3.1/dist-packages/django/db/models/manager.py", line 138, in create return self.get_query_set().create(**kwargs) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 350, in create obj.save(force_insert=True, using=self.db) File "/usr/local/lib/python3.1/dist-packages/django/db/models/base.py", line 439, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/usr/local/lib/python3.1/dist-packages/django/db/models/base.py", line 515, in save_base for f in meta.local_fields if not isinstance(f, AutoField)] File "/usr/local/lib/python3.1/dist-packages/django/db/models/base.py", line 515, in <listcomp> for f in meta.local_fields if not isinstance(f, AutoField)] File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/fields.py", line 29, in pre_save value = MyWrapper(''.join(random.sample(string.lowercase, 10))) AttributeError: 'module' object has no attribute 'lowercase'
File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line ?, in modeltests.custom_pk.models.test.API_TESTS Failed example: new_foo = Foo.objects.create(bar=new_bar) 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.custom_pk.models.test__.API_TESTS[37]>", line 1, in <module> new_foo = Foo.objects.create(bar=new_bar) NameError: name 'new_bar' is not defined
File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line ?, in modeltests.custom_pk.models.test.API_TESTS Failed example: f = Foo.objects.get(bar=new_bar) 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.custom_pk.models.test__.API_TESTS[38]>", line 1, in <module> f = Foo.objects.get(bar=new_bar) NameError: name 'new_bar' is not defined
File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line ?, in modeltests.custom_pk.models.test.API_TESTS Failed example: f == new_foo 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.custom_pk.models.test__.API_TESTS[39]>", line 1, in <module> f == new_foo NameError: name 'f' is not defined
File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/custom_pk/models.py", line ?, in modeltests.custom_pk.models.test.API_TESTS Failed example: f.bar == new_bar 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.custom_pk.models.test__.API_TESTS[40]>", line 1, in <module> f.bar == new_bar NameError: name 'f' is not defined
}}}
Comments (3)
-
-
Apparently from the code:
# FIXME: This still doesn't work, but will require some changes in # get_db_prep_lookup to fix it. # >>> f = Foo.objects.get(bar=new_bar.pk) # >>> f == new_foo # True # >>> f.bar == new_bar # True
So the tip from the comment above is to look at the function get_db_prep_lookup in django/contrib/gis/db/models/fields.py for a possible fix.
-
- changed status to wontfix
For the time being, more research is needed to look for possible fixes for the problem.
- Log in to comment
In Python3.1, the string function lowercase is being replaced by string.ascii_lowercase, so the new error generated are the following:
In which the first error belongs to ticket
#48