8000 Remove set literals · lina1/python-jsonpath-rw@8317a8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8317a8a

Browse files
committed
Remove set literals
1 parent 4ae5f3f commit 8317a8a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setuptools.setup(
1515
name='jsonpath-rw',
16-
version='0.7',
16+
version='0.8',
1717
description='A robust and significantly extended implementation of JSONPath for Python, with a clear AST for metaprogramming.',
1818
author='Kenneth Knowles',
1919
author_email='kenn.knowles@gmail.com',

tests/test_jsonpath.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,18 @@ def check_cases(self, test_cases):
9595
if isinstance(target, list):
9696
assert [r.value for r in result] == target
9797
elif isinstance(target, set):
98-
assert {r.value for r in result} == target
98+
assert set([r.value for r in result]) == target
9999
else:
100100
assert result.value == target
101101

102102
def test_fields_value(self):
103103
jsonpath.auto_id_field = None
104104
self.check_cases([ ('foo', {'foo': 'baz'}, ['baz']),
105105
('foo,baz', {'foo': 1, 'baz': 2}, [1, 2]),
106-
('*', {'foo': 1, 'baz': 2}, {1, 2}) ])
106+
('*', {'foo': 1, 'baz': 2}, set([1, 2])) ])
107107

108108
jsonpath.auto_id_field = 'id'
109-
self.check_cases([ ('*', {'foo': 1, 'baz': 2}, {1, 2, '@'}) ])
109+
self.check_cases([ ('*', {'foo': 1, 'baz': 2}, set([1, 2, '@'])) ])
110110

111111
def test_index_value(self):
112112
self.check_cases([
@@ -154,18 +154,18 @@ def check_paths(self, test_cases):
154154
if isinstance(target, list):
155155
assert [str(r.full_path) for r in result] == target
156156
elif isinstance(target, set):
157-
assert {str(r.full_path) for r in result} == target
157+
assert set([str(r.full_path) for r in result]) == target
158158
else:
159159
assert str(result.path) == target
160160

161161
def test_fields_paths(self):
162162
jsonpath.auto_id_field = None
163163
self.check_paths([ ('foo', {'foo': 'baz'}, ['foo']),
164164
('foo,baz', {'foo': 1, 'baz': 2}, ['foo', 'baz']),
165-
('*', {'foo': 1, 'baz': 2}, {'foo', 'baz'}) ])
165+
('*', {'foo': 1, 'baz': 2}, set(['foo', 'baz'])) ])
166166

167167
jsonpath.auto_id_field = 'id'
168-
self.check_paths([ ('*', {'foo': 1, 'baz': 2}, {'foo', 'baz', 'id'}) ])
168+
self.check_paths([ ('*', {'foo': 1, 'baz': 2}, set(['foo', 'baz', 'id'])) ])
169169

170170
def test_index_paths(self):
171171
self.check_paths([('[0]', [42], ['[0]']),
@@ -195,7 +195,7 @@ def test_fields_auto_id(self):
195195
('*.id',
196196
{'foo':{'id': 1},
197197
'baz': 2},
198-
{'1', 'baz'}) ])
198+
set(['1', 'baz'])) ])
199199

200200
def test_index_auto_id(self):
201201
jsonpath.auto_id_field = "id"

0 commit comments

Comments
 (0)
0