diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-07 02:14:58 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-07 02:14:58 +0200 |
commit | 4bcf146c71589f4b225823eb418ee6908b2efb6b (patch) | |
tree | 86b997075cf56fa3ac0b9510910c2487995f9a41 /README | |
parent | 0708fc0bbf29e4426075fcedd45a2d41c6271282 (diff) | |
download | factory-boy-4bcf146c71589f4b225823eb418ee6908b2efb6b.tar factory-boy-4bcf146c71589f4b225823eb418ee6908b2efb6b.tar.gz |
Add and document abstract factories (Closes #8).
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'README')
-rw-r--r-- | README | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -220,4 +220,20 @@ the global factory, using a simple syntax : ``field__attr=42`` will set the attr >>> e2.bar 'baz' +Abstract factories +------------------ + +If a ``Factory`` simply defines generic attribute declarations without being bound to a given class, +it should be marked 'abstract' by declaring ``ABSTRACT_FACTORY = True``. +Such factories cannot be built/created/.... + + + class AbstractFactory(factory.Factory): + ABSTRACT_FACTORY = True + foo = 'foo' + + >>> AbstractFactory() + Traceback (most recent call last): + ... + AttributeError: type object 'AbstractFactory' has no attribute '_associated_class' |