Ejemplo n.º 1
0
 def dumps_attrs_in_defined_order():
     context = Context('text').any().equal('meh')
     assert jsonify(context) == dedent('''\
         {
           "key": "text",
           "operator": "equal",
           "operand": "meh",
           "match_all": false
         }''')
Ejemplo n.º 2
0
 def sorts_dict_values():
     binding = Binding('x').to('foo', z=1, o=2, a=3, c=4)
     assert jsonify(binding) == dedent('''\
         {
           "keys": [
             "x"
           ],
           "command": "foo",
           "args": {
             "a": 3,
             "c": 4,
             "o": 2,
             "z": 1
           }
         }''')
Ejemplo n.º 3
0
 def dumps_attrs_in_defined_order():
     binding = Binding('x', 'y').to('new_pane', move=False)
     binding.when('foo')
     assert jsonify(binding) == dedent('''\
         {
           "keys": [
             "x",
             "y"
           ],
           "command": "new_pane",
           "args": {
             "move": false
           },
           "context": [
             {
               "key": "foo"
             }
           ]
         }''')
Ejemplo n.º 4
0
 def omits_empty_lists():
     binding = Binding('x').to('new_pane')
     assert '"context"' not in jsonify(binding)
Ejemplo n.º 5
0
 def omits_empty_dicts():
     binding = Binding('x').to('new_pane')
     assert '"args"' not in jsonify(binding)
Ejemplo n.º 6
0
 def omits_None_values():
     binding = Binding('x')
     assert '"command"' not in jsonify(binding)
Ejemplo n.º 7
0
 def omits_None_values():
     context = Context('text')
     assert '"operand"' not in jsonify(context)