示例#1
0
def test_round_trip(bwamem_help):
    command = parse_help(["bwa", "mem"], bwamem_help)

    # Dump
    buffer = StringIO()
    yaml.dump(command, buffer)

    # Load
    buffer.seek(0)
    output = yaml.load(buffer)

    # Assert the round trip worked
    assert command == output
示例#2
0
 def save_to_file(self, cmd: Command, path: Path) -> None:
     map = self.command_to_tool(cmd).save()
     with path.open("w") as fp:
         yaml.dump(map, fp)
示例#3
0
 def save_to_string(self, cmd: Command) -> str:
     buffer = StringIO()
     yaml.dump(cmd, buffer)
     return buffer.getvalue()
示例#4
0
 def save_to_string(self, cmd: Command) -> str:
     io = StringIO()
     yaml.dump(self.command_to_tool(cmd).save(), io)
     return io.getvalue()
示例#5
0
 def save_to_file(self, cmd: Command, path: Path) -> None:
     with path.open("w") as fp:
         yaml.dump(cmd, fp)