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)
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)
class Input: ctl = Field(listof(str)) stdin = Field(str, default='') expect = Field(int, default=0) def __str__(self): return "CTL: %s" % " ".join(self.ctl)
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)]
class Output: end_ctl = Field(listof(str)) stdout = Field(str)
class Input: end_ctl = Field(listof(str)) def __str__(self): return "END-CTL: %s" % " ".join(self.end_ctl)