Skip to content

Commit caebf7b

Browse files
author
selston
committed
contineu bug fix and added another test with sort order
1 parent 55ecf05 commit caebf7b

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

jsoncompare/jsoncompare.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def contains(expected_original, actual_original, ignore_list_order_recursively=F
159159
actual = _bottom_up_sort(actual_original)
160160
expected = _bottom_up_sort(expected_original)
161161
else:
162-
actual = actual_orginal
162+
actual = actual_original
163163
expected = expected_original
164164
return _are_same(expected, actual, ignore_value_of_keys, True)
165165

jsoncompare/test/test_jsoncompare.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,20 @@ def test_contains_same_size(self):
265265
#same, error_message = jsoncompare.contains(expected, actual)
266266
#assert same, error_message
267267

268-
# Test two json that are same size but values do not match
268+
# Test two json that are same size and keys/values match with ignore_order
269269
def test_contains_same_size2(self):
270+
actual = [
271+
{"wtf": "omg"},
272+
{"wtf1": "omg1"}
273+
]
274+
expected = [
275+
{"wtf": "omg"},
276+
{"wtf1": "omg1"}
277+
]
278+
self.assertTrue(jsoncompare.contains(expected, actual, True)[0])
279+
280+
# Test two json that are same size but values do not match
281+
def test_contains_same_size3(self):
270282
actual = [
271283
{"wtf": "omg"},
272284
{"wtf1": "omg1"}
@@ -280,7 +292,7 @@ def test_contains_same_size2(self):
280292
#assert same, error_message
281293

282294
# Test two json that are same size but keys do not match
283-
def test_contains_same_size3(self):
295+
def test_contains_same_size4(self):
284296
actual = [
285297
{"wtf": "omg"},
286298
{"wtf1": "omg1"}
@@ -290,8 +302,8 @@ def test_contains_same_size3(self):
290302
{"wtf999": "omg1"}
291303
]
292304
self.assertFalse(jsoncompare.contains(expected, actual)[0])
293-
same, error_message = jsoncompare.contains(expected, actual)
294-
assert same, error_message
305+
#same, error_message = jsoncompare.contains(expected, actual)
306+
#assert same, error_message
295307

296308
# Test two json where Actual is larger - it can (potentialy) contain all of the expected attributes
297309
def test_contains_actual_bigger(self):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def read_readme(fname):
1212

1313
setup(
1414
name = 'jsoncompare',
15-
version = '0.1.1',
15+
version = '0.1.2',
1616
description = 'Json comparison tool',
1717
author = 'Daniel Myers',
1818
author_email = '[email protected]',

0 commit comments

Comments
 (0)