Skip to content

Tests fail for Python 3.x #1

@ppope

Description

@ppope

Tests work under Python 2.7 as expected. However, with

$ python --version
Python 3.4.3 :: Anaconda 2.2.0 (64-bit)

Running

$ python ./test/test_sorted.py

Obtains (truncated traceback)

ERROR: test_inorder (__main__.SortedTest)
...
  File "./test/test_sorted.py", line 9, in sort
    items[:] = sorted(items)
TypeError: 'range' object does not support item assignment

and

ERROR: test_stability (__main__.SortedTest)
...
    items[:] = sorted(items)
TypeError: unorderable types: IntHolder() < IntHolder()

First error is due to range being a generator object by default in Python 3. See this SO post. Should be a quick fix by changing items = range(1,i,d) to items = list(range(1,i,d)) in sort_tester.py.

I'm not sure about the second just yet.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions