Example #1
0
def test_boxed_alias():
    w = Way(u'.')
    assert w.value == u'.'
    assert Way(Path(u'.')).value == u'.'
    assert Way.__nirum_deserialize__(u'.') == Way(u'.')
    assert Way(u'.').__nirum_serialize__() == u'.'
    assert Name(u'khj') == Irum(u'khj')
    assert Irum.__nirum_deserialize__(u'khj') == Irum(u'khj')
    assert Irum(u'khj').__nirum_serialize__() == u'khj'
    assert Irum.__nirum_deserialize__(u'khj') == Name(u'khj')
    assert Irum.__nirum_deserialize__(u'khj') == Irum(u'khj')
Example #2
0
def fx_method_args(fx_dog):
    return (
        collections.OrderedDict([
            ('a', fx_dog[0]),
            ('b', Product(name=u'Product.name', sale=False)),
            ('c', Gender.female),
            ('d', Way(u'way/path/text')),
            ('e', uuid.UUID('F7DB93E3-731E-48EF-80A2-CAC81E02F1AE')),
            ('f', b'binary data'),
            ('g', 1234),
            ('h', u'text data'),
        ]),
        collections.OrderedDict([
            ('a', fx_dog[1]),
            ('bb', {
                '_type': 'product',
                'name': 'Product.name',
                'price': None,
                'sale': False,
                'url': None,
            }),
            ('c', 'yeoseong'),
            ('dd', 'way/path/text'),
            ('e', 'f7db93e3-731e-48ef-80a2-cac81e02f1ae'),
            ('ff', u'YmluYXJ5IGRhdGE='),
            ('g', 1234),
            ('hh', 'text data'),
        ]),
    )
Example #3
0
def test_service_client_payload_serialization():
    t = DumbTransport()
    c = SampleService_Client(t)
    c.sample_method(a=Dog(name=u'Dog.name', age=3),
                    b=Product(name=u'Product.name', sale=False),
                    c=Gender.female,
                    d=Way(u'way/path/text'),
                    e=uuid.UUID('F7DB93E3-731E-48EF-80A2-CAC81E02F1AE'),
                    f=b'binary data',
                    g=1234,
                    h=u'text data')
    assert t.latest_call[0] == 'sample_method'
    assert t.latest_call[1] == {
        'a': {
            '_type': 'animal',
            '_tag': 'dog',
            'name': 'Dog.name',
            'kind': None,
            'age': 3,
            'weight': None,
        },
        'bb': {
            '_type': 'product',
            'name': 'Product.name',
            'price': None,
            'sale': False,
            'url': None,
        },
        'c': 'yeoseong',
        'dd': 'way/path/text',
        'e': 'f7db93e3-731e-48ef-80a2-cac81e02f1ae',
        'ff': u'YmluYXJ5IGRhdGE=',
        'g': 1234,
        'hh': 'text data',
    }