[py3k] import range from six.moves

Related to #296242.

authorRémi Cardona <remi.cardona@free.fr>
changesetc47e2682cf2f
branchdefault
phasepublic
hiddenno
parent revision#cb9c4e81d12f Use new-style classes everywhere
child revision#79b94e449bba [py3k] except as
files modified by this revision
distributors.py
test/test_constraints.py
test/test_domains.py
test/test_propagation.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@free.fr>
# Date 1405887385 -7200
# Sun Jul 20 22:16:25 2014 +0200
# Node ID c47e2682cf2fb40481595894e2ead714507eaa4e
# Parent cb9c4e81d12f27d966a2caf85d6ebac08874462a
[py3k] import range from six.moves

Related to #296242.

diff --git a/distributors.py b/distributors.py
@@ -18,10 +18,11 @@
1 
2  """
3  distributors - part of Logilab's constraint satisfaction solver.
4  """
5 
6 +from six.moves import range
7  from logilab.constraint.interfaces import DistributorInterface
8  import math, random
9 
10  def make_new_domains(domains):
11      """return a shallow copy of dict of domains passed in argument"""
diff --git a/test/test_constraints.py b/test/test_constraints.py
@@ -16,11 +16,14 @@
12  # You should have received a copy of the GNU Lesser General Public License along
13  # with logilab-constraint. If not, see <http://www.gnu.org/licenses/>.
14  """Unit testing for constraint propagation module"""
15 
16  import unittest
17 +
18 +from six.moves import range
19  from logilab.common.testlib import TestCase, TestSuite
20 +
21  from logilab.constraint import fd
22  from logilab.constraint import propagation
23  from logilab.constraint import distributors
24 
25 
diff --git a/test/test_domains.py b/test/test_domains.py
@@ -16,10 +16,11 @@
26  # You should have received a copy of the GNU Lesser General Public License along
27  # with logilab-constraint. If not, see <http://www.gnu.org/licenses/>.
28  """Unit testing for constraint propagation module"""
29 
30  import unittest
31 +from six.moves import range
32  from logilab.common.testlib import TestCase, TestSuite
33  from logilab.constraint import fd
34  from logilab.constraint import propagation
35  from logilab.constraint import distributors
36 
@@ -63,11 +64,11 @@
37              exception = 1
38          assert exception
39 
40  class SuiteDomainTC(AbstractDomainTC):
41      def setUp(self):
42 -        self.values = range(3)
43 +        self.values = list(range(3))
44          self.domain = fd.FiniteDomain(self.values)
45 
46 
47 
48  def get_all_cases(module):
diff --git a/test/test_propagation.py b/test/test_propagation.py
@@ -16,10 +16,11 @@
49  # You should have received a copy of the GNU Lesser General Public License along
50  # with logilab-constraint. If not, see <http://www.gnu.org/licenses/>.
51  """Unit testing for constraint propagation module"""
52 
53  import unittest
54 +from six.moves import range
55  from logilab.common.testlib import TestCase, TestSuite
56  import os
57  from logilab.constraint.propagation import *
58  from logilab.constraint import fd
59  from logilab.constraint.distributors import DefaultDistributor
@@ -94,11 +95,11 @@
60      def setUp(self):
61          self.solver = Solver()
62          self.domains = {}
63          self.variables = list('abcdef')
64          for v in self.variables:
65 -            self.domains[v] = fd.FiniteDomain(range(6))
66 +            self.domains[v] = fd.FiniteDomain(list(range(6)))
67 
68          self.repo = Repository(self.variables, self.domains)
69          for v1 in self.variables:
70              for v2 in self.variables:
71                  if v1 < v2: