Esempio n. 1
0
def test_nest_maintains_order():
    nested = qstring.nest([
        ('a', '1'),
        ('b[a]', '1'),
        ('b[b]', '2'),
        ('b[c]', '3'),
        ('c[a][a]', '1'),
        ('c[a][b]', '2'),
        ('c[a][c]', '3'),
    ])
    assert list(nested.keys()) == ['a', 'b', 'c']
    assert list(nested['b'].keys()) == ['a', 'b', 'c']
    assert list(nested['c']['a'].keys()) == ['a', 'b', 'c']
Esempio n. 2
0
def test_nest_maintains_order():
    nested = qstring.nest([
        ('a', '1'),
        ('b[a]', '1'),
        ('b[b]', '2'),
        ('b[c]', '3'),
        ('c[a][a]', '1'),
        ('c[a][b]', '2'),
        ('c[a][c]', '3'),
    ])
    assert list(nested.keys()) == ['a', 'b', 'c']
    assert list(nested['b'].keys()) == ['a', 'b', 'c']
    assert list(nested['c']['a'].keys()) == ['a', 'b', 'c']
Esempio n. 3
0
def test_nest(obj, expected):
    assert qstring.nest(obj) == expected
Esempio n. 4
0
 def _build_params(self, type):
     return Parameters(resource_registry=self.resource_registry,
                       type=type,
                       params=qstring.nest(request.args.items(multi=True)))
Esempio n. 5
0
def test_nest(obj, expected):
    assert qstring.nest(obj) == expected