def test_init(self): """ When calling `Payload.init` With an encoder We use that encoder With no encoder We use the default encoder """ default_encoder_type = type(get_encoder()) payload = Payload() self.assertIsInstance(payload.encoder, default_encoder_type) json_encoder = JSONEncoder() payload = Payload(encoder=json_encoder) self.assertEqual(payload.encoder, json_encoder)
def test_get_encoder_fallback(self): # get_encoder should return JSONEncoder instance if # msgpack or the CPP implementaiton, are not available encoder = get_encoder() assert isinstance(encoder, JSONEncoder)
def test_get_encoder_default(self): # get_encoder should return MsgpackEncoder instance if # msgpack and the CPP implementaiton are available encoder = get_encoder() assert isinstance(encoder, MsgpackEncoder)
def test_get_encoder_fallback(self): # get_encoder should return JSONEncoder instance if # msgpack or the CPP implementaiton, are not available encoder = get_encoder() ok_(isinstance(encoder, JSONEncoder))
def test_get_encoder_default(self): # get_encoder should return MsgpackEncoder instance if # msgpack and the CPP implementaiton are available encoder = get_encoder() ok_(isinstance(encoder, MsgpackEncoder))