Fix py3 tests
This commit is contained in:
parent
28fe3fb541
commit
1e1218780c
|
@ -11,9 +11,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import operator
|
||||
|
||||
import jsonpath_rw
|
||||
import operator
|
||||
from six import moves
|
||||
|
||||
|
||||
OPERATOR_MAP = {
|
||||
|
@ -41,10 +41,10 @@ class Filter(jsonpath_rw.JSONPath):
|
|||
return [jsonpath_rw.DatumInContext(datum.value[i],
|
||||
path=jsonpath_rw.Index(i),
|
||||
context=datum)
|
||||
for i in xrange(0, len(datum.value))
|
||||
for i in moves.range(0, len(datum.value))
|
||||
if (len(self.expressions) ==
|
||||
len(filter(lambda x: x.find(datum.value[i]),
|
||||
self.expressions)))]
|
||||
len(list(filter(lambda x: x.find(datum.value[i]),
|
||||
self.expressions))))]
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.expressions)
|
||||
|
|
|
@ -18,6 +18,11 @@ from jsonpath_rw import parser
|
|||
from jsonpath_rw_ext import _filter
|
||||
from jsonpath_rw_ext import _iterable
|
||||
|
||||
# NOTE(sileht): This block is very important otherwise py3X tests fail no joke
|
||||
# ply/yacc.py order functions by line, then by module, but in py3 module are
|
||||
# not sortable, so we add this block to not have methods defined at the same
|
||||
# line in jsonpath_rw and jsonpath_rw_ext, yes that really sucks ...
|
||||
|
||||
|
||||
class ExtendedJsonPathLexer(lexer.JsonPathLexer):
|
||||
"""Custom LALR-lexer for JsonPath"""
|
||||
|
|
Loading…
Reference in New Issue