Exemplo n.º 1
0
def yaml_writer(data, file, ctx):
    kwds = {}
    if ctx.opts.flags.pretty:
        kwds.update(dict(default_flow_style=False))
    data = output_prefix(data, ctx.opts)
    if not data and ctx.opts.flags.empty_null:
        file.write('\n')
    else:
        yaml_safe_dump(data, file, **kwds)
Exemplo n.º 2
0
 def test_1_cmd_clean_mode(self):
     ""
     for params, expected in self.cmd_clean_mode_specs:
         self.ctx.out = StringIO()
         self.ctx.opts = params
         ret = pd_meta.H_clean_mode(self.cmd_clean_mode_data, self.ctx)
         if not ret: ret = 0
         self.assertEquals( expected[0], ret, ("%s is not %s, for " % (ret, expected[0])) + yaml_safe_dump(params.todict()))
         self.assertEquals( self.ctx.out.getvalue().strip(), expected[1] )