Beispiel #1
0
    def test_default(self):
        ref = s.TypeRef('Foo', s.Kind.ENUM, None)

        classes = {'Foo': quiz.Enum('Foo', {})}
        resolved = s.resolve_typeref(ref, classes)
        assert issubclass(resolved, quiz.Nullable)
        assert resolved.__arg__ is classes['Foo']
Beispiel #2
0
from functools import partial

import quiz as q
from quiz.utils import FrozenDict

mkfield = partial(
    q.FieldDefinition,
    args=FrozenDict.EMPTY,
    is_deprecated=False,
    desc="",
    deprecation_reason=None,
)

Command = q.Enum("Command", {
    "SIT": "SIT",
    "DOWN": "DOWN",
    "ROLL_OVER": "ROLL_OVER"
})

Color = q.Enum("Color", {
    "BROWN": "BROWN",
    "BLACK": "BLACK",
    "GOLDEN": "GOLDEN"
})


class MyDateTime(q.Scalar):
    """an example datetime"""
    def __init__(self, dtime):
        self.dtime = dtime
Beispiel #3
0
from datetime import datetime
from functools import partial

import quiz as q
import six
from quiz.utils import FrozenDict

mkfield = partial(q.FieldDefinition,
                  args=FrozenDict.EMPTY,
                  is_deprecated=False,
                  desc='',
                  deprecation_reason=None)

Command = q.Enum('Command', {
    'SIT': 'SIT',
    'DOWN': 'DOWN',
    'ROLL_OVER': 'ROLL_OVER',
})

Color = q.Enum('Color', {
    'BROWN': 'BROWN',
    'BLACK': 'BLACK',
    'GOLDEN': 'GOLDEN',
})


class MyDateTime(q.Scalar):
    """an example datetime"""
    def __init__(self, dtime):
        self.dtime = dtime