Esempio n. 1
0
class MsgConnected(MsgpackMsg):
    """
    Sent by the server in reply to MsgConnect.
    """

    object_type = 'connected'

    proto_version = fields.SmallInteger(minimum=1)
    server_name = fields.String()
    server_version = fields.String()
Esempio n. 2
0
class MsgConnect(MsgpackMsg):
    """
    Sent by the client immediately upon connection.  Server replies with
    MsgConnected or MsgConnectionError.
    """

    object_type = 'connect'

    proto_version = fields.SmallInteger(minimum=1)
    client_name = fields.String(optional=True)
    client_version = fields.String(optional=True)
    client_description = fields.String(optional=True)
    client_type = fields.String(optional=True)
    quit_on_close = fields.Boolean(default=False)
Esempio n. 3
0
 def test_small_integer(self):
     a = fields.SmallInteger()
     a.validate(0)
     a.validate(-1)
     a.validate(1)
     a.validate(-0x8000000000000000)
     a.validate(0x7fffffffffffffff)
     with self.assertRaises(SchemaError):
         a.validate(-0x8000000000000001)
     with self.assertRaises(SchemaError):
         a.validate(0x8000000000000000)
     fields.SmallInteger(minimum=-1)
     fields.SmallInteger(maximum=-1)
     fields.SmallInteger(maximum=0x7fffffffffffffff)
     fields.SmallInteger(minimum=-0x8000000000000000)
     with self.assertRaises(ValueError):
         fields.SmallInteger(maximum=0x8000000000000000)
     with self.assertRaises(ValueError):
         fields.SmallInteger(minimum=-0x8000000000000001)
     with self.assertRaises(TypeError):
         fields.SmallInteger(maximum=None)
     with self.assertRaises(TypeError):
         fields.SmallInteger(minimum=None)
Esempio n. 4
0
class List(model.Model):
    a = fields.List(fields.SmallInteger())
Esempio n. 5
0
class SmallInteger(model.Model):
    a = fields.SmallInteger(default=-42)
Esempio n. 6
0
class SmallIntegerOptional(model.Model):
    a = fields.SmallInteger(optional=True)
Esempio n. 7
0
class MapOptional(model.Model):
    a = fields.Map(fields.String(),
                   fields.SmallInteger(),
                   optional=True,
                   default=None)
Esempio n. 8
0
class Map(model.Model):
    a = fields.Map(fields.String(), fields.SmallInteger())
Esempio n. 9
0
class SetOptional(model.Model):
    a = fields.Set(fields.SmallInteger(), optional=True, default=None)
Esempio n. 10
0
class Set(model.Model):
    a = fields.Set(fields.SmallInteger())
Esempio n. 11
0
class FieldTypeFixed(FieldType):
    shift = fields.SmallInteger()
    sign_mode = fields.Enum(FieldSignMode)