Пример #1
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)
Пример #2
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)
Пример #3
0
    class Input:
        connect = Field(maybe(oneof(str, dictof(str, object))))
        sql = Field(str)
        autocommit = Field(bool, default=False)
        ignore = Field(bool, default=False)

        @property
        def sql_key(self):
            if is_filename(self.sql):
                return self.sql
            else:
                return to_identifier(self.sql)

        @property
        def sql_as_filename(self):
            if is_filename(self.sql):
                return self.sql

        @property
        def sql_as_source(self):
            if not is_filename(self.sql):
                return self.sql

        def __str__(self):
            return "SQL: %s" % self.sql_key
Пример #4
0
    class Input(object):  # noqa: pydocstyle:D106
        tidypy = Field(
            maybe(str),
            hint='The path to the base of project. Defaults to CWD.',
        )

        fail_on_issue = Field(
            bool,
            default=True,
            hint='Whether or not the test should fail if TidyPy finds issues.')
Пример #5
0
    class Input:
        db = Field(maybe(oneof(str, dictof(str, object))))
        extensions = Field(dictof(str, dictof(str, object)), default={})
        save = Field(str, default=None)

        def __str__(self):
            if not self.db:
                return "DB: -"
            try:
                from htsql.core.util import DB
            except ImportError:
                return "DB: -"
            try:
                db = DB.parse(self.db)
            except ValueError:
                return "DB: -"
            db = db.clone(password=None)
            return "DB: %s" % db
Пример #6
0
 class Input:
     uri = Field(str)
     method = Field(choiceof(['GET', 'POST']), default='GET')
     remote_user = Field(str, default=None)
     headers = Field(dictof(str, str), default=None)
     content_type = Field(str, default=None)
     content_body = Field(str, default=None)
     expect = Field(int, default=200)
Пример #7
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)]
Пример #8
0
 class Output:
     end_ctl = Field(listof(str))
     stdout = Field(str)
Пример #9
0
    class Input:
        end_ctl = Field(listof(str))

        def __str__(self):
            return "END-CTL: %s" % " ".join(self.end_ctl)
Пример #10
0
 class Input:
     load = Field(str)
     extensions = Field(dictof(str, dictof(str, object)), default={})
     save = Field(str, default=None)