Issue #29 resolved

TypeError description changed in Python 3.x

Johan Harjono
created an issue

{{{

!python

File "/home/johan/workspace/fiji/build/tests/modeltests/lookup/models.py", line ?, in modeltests.lookup.models.test.API_TESTS Failed example: Article.objects.in_bulk() Expected: Traceback (most recent call last): ... TypeError: in_bulk() takes exactly 2 arguments (1 given) Got: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1275, in run compileflags, 1), test.globs) File "<doctest modeltests.lookup.models.test__.API_TESTS[38]>", line 1, in <module> Article.objects.in_bulk() File "/usr/local/lib/python3.1/dist-packages/django/db/models/manager.py", line 156, in in_bulk return self.get_query_set().in_bulk(args, *kwargs) TypeError: in_bulk() takes exactly 2 positional arguments (1 given) }}}

Comments (3)

  1. Johan Harjono reporter

    Confirmed: this is a Python 3.x conversion problem:

    on

    #!/usr/bin/python
    
    def in_bulk(blah):
        return blah
        
    # TypeError time!
    in_bulk()
    

    running the above script:

    johan@johan-laptop:~/Desktop$ python a.py 
    Traceback (most recent call last):
      File "a.py", line 7, in <module>
        in_bulk()
    TypeError: in_bulk() takes exactly 1 argument (0 given)
    johan@johan-laptop:~/Desktop$ python3.1 a.py 
    Traceback (most recent call last):
      File "a.py", line 7, in <module>
        in_bulk()
    TypeError: in_bulk() takes exactly 1 positional argument (0 given)
    
  2. Log in to comment