示例#1
0
import cllsd
import time, sys

class myint(int):
    pass

values = (
    '&<>',
    u'\u81acj',
    llsd.uri('http://foo<'),
    lluuid.LLUUID(),
    llsd.LLSD(['thing']),
    1,
    myint(31337),
    sys.maxint + 10,
    llsd.binary('foo'),
    [],
    {},
    {u'f&\u1212': 3},
    3.1,
    True,
    None,
    datetime.fromtimestamp(time.time()),
    )

def valuator(values):
    for v in values:
        yield v

longvalues = () # (values, list(values), iter(values), valuator(values))

class myint(int):
    pass


values = (
    '&<>',
    u'\u81acj',
    llsd.uri('http://foo<'),
    lluuid.UUID(),
    llsd.LLSD(['thing']),
    1,
    myint(31337),
    sys.maxint + 10,
    llsd.binary('foo'),
    [],
    {},
    {
        u'f&\u1212': 3
    },
    3.1,
    True,
    None,
    datetime.fromtimestamp(time.time()),
)


def valuator(values):
    for v in values:
        yield v
示例#3
0
        'float_zero': 0,
        'float': math.pi,
        'float_huge': 3.14159265358979323846e299,
        'str_empty': '',
        'str': 'foo',
        u'unic\u1e51de_empty': u'',
        u'unic\u1e51de': u'\u1e4exx\u10480',
        }
    json_safe['array'] = json_safe.values()
    json_safe['tuple'] = tuple(json_safe.values())
    json_safe['dict'] = json_safe.copy()

    json_unsafe = {
        'uuid_empty': lluuid.UUID(),
        'uuid_full': lluuid.UUID('dc61ab0530200d7554d23510559102c1a98aab1b'),
        'binary_empty': llsd.binary(),
        'binary': llsd.binary('f\0\xff'),
        'uri_empty': llsd.uri(),
        'uri': llsd.uri('http://www.secondlife.com/'),
        'datetime_empty': datetime.datetime(1970,1,1),
        'datetime': datetime.datetime(1999,9,9,9,9,9),
        }
    json_unsafe.update(json_safe)
    json_unsafe['array'] = json_unsafe.values()
    json_unsafe['tuple'] = tuple(json_unsafe.values())
    json_unsafe['dict'] = json_unsafe.copy()
    json_unsafe['iter'] = iter(json_unsafe.values())

    def _test_client_content_type_good(self, content_type, ll):
        def run(ll):
            req = siesta.Request.blank('/')
示例#4
0
        'float_zero': 0,
        'float': math.pi,
        'float_huge': 3.14159265358979323846e299,
        'str_empty': '',
        'str': 'foo',
        u'unic\u1e51de_empty': u'',
        u'unic\u1e51de': u'\u1e4exx\u10480',
    }
    json_safe['array'] = json_safe.values()
    json_safe['tuple'] = tuple(json_safe.values())
    json_safe['dict'] = json_safe.copy()

    json_unsafe = {
        'uuid_empty': lluuid.UUID(),
        'uuid_full': lluuid.UUID('dc61ab0530200d7554d23510559102c1a98aab1b'),
        'binary_empty': llsd.binary(),
        'binary': llsd.binary('f\0\xff'),
        'uri_empty': llsd.uri(),
        'uri': llsd.uri('http://www.secondlife.com/'),
        'datetime_empty': datetime.datetime(1970, 1, 1),
        'datetime': datetime.datetime(1999, 9, 9, 9, 9, 9),
    }
    json_unsafe.update(json_safe)
    json_unsafe['array'] = json_unsafe.values()
    json_unsafe['tuple'] = tuple(json_unsafe.values())
    json_unsafe['dict'] = json_unsafe.copy()
    json_unsafe['iter'] = iter(json_unsafe.values())

    def _test_client_content_type_good(self, content_type, ll):
        def run(ll):
            req = siesta.Request.blank('/')
示例#5
0
        "float_zero": 0,
        "float": math.pi,
        "float_huge": 3.14159265358979323846e299,
        "str_empty": "",
        "str": "foo",
        u"unic\u1e51de_empty": u"",
        u"unic\u1e51de": u"\u1e4exx\u10480",
    }
    json_safe["array"] = json_safe.values()
    json_safe["tuple"] = tuple(json_safe.values())
    json_safe["dict"] = json_safe.copy()

    json_unsafe = {
        "uuid_empty": lluuid.UUID(),
        "uuid_full": lluuid.UUID("dc61ab0530200d7554d23510559102c1a98aab1b"),
        "binary_empty": llsd.binary(),
        "binary": llsd.binary("f\0\xff"),
        "uri_empty": llsd.uri(),
        "uri": llsd.uri("http://www.secondlife.com/"),
        "datetime_empty": datetime.datetime(1970, 1, 1),
        "datetime": datetime.datetime(1999, 9, 9, 9, 9, 9),
    }
    json_unsafe.update(json_safe)
    json_unsafe["array"] = json_unsafe.values()
    json_unsafe["tuple"] = tuple(json_unsafe.values())
    json_unsafe["dict"] = json_unsafe.copy()
    json_unsafe["iter"] = iter(json_unsafe.values())

    def _test_client_content_type_good(self, content_type, ll):
        def run(ll):
            req = siesta.Request.blank("/")