Exemplo n.º 1
0
 def __load__(cls, mapping):
     if 'headers' in mapping and \
             isinstance(mapping['headers'], listof(listof(str, length=2))):
         mapping['headers'] = [
             tuple(header) for header in mapping['headers']
         ]
     return super(QueryCase.Output, cls).__load__(mapping)
Exemplo n.º 2
0
    class Input:
        start_ctl = Field(listof(str))
        stdin = Field(str, default='')
        sleep = Field(oneof(int, float), default=0)

        def __str__(self):
            return "START-CTL: %s" % " ".join(self.start_ctl)
Exemplo n.º 3
0
    class Input:
        ctl = Field(listof(str))
        stdin = Field(str, default='')
        expect = Field(int, default=0)

        def __str__(self):
            return "CTL: %s" % " ".join(self.ctl)
Exemplo n.º 4
0
    class Output:
        uri = Field(str)
        status = Field(str)
        headers = Field(listof(tupleof(str, str)))
        body = Field(str)

        @classmethod
        def __load__(cls, mapping):
            if 'headers' in mapping and \
                    isinstance(mapping['headers'], listof(listof(str, length=2))):
                mapping['headers'] = [
                    tuple(header) for header in mapping['headers']
                ]
            return super(QueryCase.Output, cls).__load__(mapping)

        def __dump__(self):
            return [('uri', self.uri), ('status', self.status),
                    ('headers', [list(header) for header in self.headers]),
                    ('body', self.body)]
Exemplo n.º 5
0
 class Output:
     end_ctl = Field(listof(str))
     stdout = Field(str)
Exemplo n.º 6
0
    class Input:
        end_ctl = Field(listof(str))

        def __str__(self):
            return "END-CTL: %s" % " ".join(self.end_ctl)