Convert inputs to OrderedDicts

This commit is contained in:
Jonathan Kim 2018-07-01 21:19:19 +01:00
parent 1f541e4467
commit 1e40eceab3

View File

@ -1,4 +1,5 @@
import pytest
from collections import OrderedDict
from ..crunch import crunch
@ -17,22 +18,29 @@ from ..crunch import crunch
['single-item object', {'a': None}, [None, {'a': 0}]],
[
'multi-item all distinct object',
{'a': None, 'b': 0, 'c': True, 'd': "string"},
OrderedDict([('a', None), ('b', 0), ('c', True), ('d', 'string')]),
[None, 0, True, "string", {'a': 0, 'b': 1, 'c': 2, 'd': 3}]
],
[
'multi-item repeated object',
{'a': True, 'b': True, 'c': True, 'd': True},
OrderedDict([('a', True), ('b', True), ('c', True), ('d', True)]),
[True, {'a': 0, 'b': 0, 'c': 0, 'd': 0}]
],
[
'complex array',
[{'a': True, 'b': [1, 2, 3]}, [1, 2, 3]],
[
OrderedDict([('a', True), ('b', [1, 2, 3])]),
[1, 2, 3]
],
[True, 1, 2, 3, [1, 2, 3], {'a': 0, 'b': 4}, [5, 4]]
],
[
'complex object',
{'a': True, 'b': [1, 2, 3], 'c': {'a': True, 'b': [1, 2, 3]}},
OrderedDict([
('a', True),
('b', [1, 2, 3]),
('c', OrderedDict([('a', True), ('b', [1, 2, 3])]))
]),
[True, 1, 2, 3, [1, 2, 3], {'a': 0, 'b': 4}, {'a': 0, 'b': 4, 'c': 5}]
],
])