Beispiel #1
0
    def test_should_return_a_list_of_encoded_models(self):
        users = [User(), User()]

        self.encoder = encoders.List(encoders.Model())
        result = self.encoder(users)

        expect(result).to(equal([users[0].encode(), users[1].encode()]))
Beispiel #2
0
    def __init__(self, model, *args, **kwargs):
        kwargs.setdefault('encoders', []).append(builtin_encoders.Model())
        kwargs.setdefault('decoders', []).append(builtin_decoders.Model(model))

        super(EmbeddedField, self).__init__(builtin_validators.Model(model),
                                            *args, **kwargs)

        self.model = model
Beispiel #3
0
 def setup(self):
     self.encoder = encoders.Model()