summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-04-07 02:14:58 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-04-07 02:14:58 +0200
commit4bcf146c71589f4b225823eb418ee6908b2efb6b (patch)
tree86b997075cf56fa3ac0b9510910c2487995f9a41 /README
parent0708fc0bbf29e4426075fcedd45a2d41c6271282 (diff)
downloadfactory-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--README16
1 files changed, 16 insertions, 0 deletions
diff --git a/README b/README
index e41e07a..aa64a1f 100644
--- a/README
+++ b/README
@@ -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'