diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2012-04-13 19:33:54 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2012-04-15 10:06:39 +0200 |
commit | b590e5014351a79d66d2f4816b1a6aa83908f395 (patch) | |
tree | 7f76fd7f6fcb3fdcef48ab83ba589be43fb55f65 /factory | |
parent | 27dcb6fe29a09d6cb2d83a59229e562093da4f7b (diff) | |
download | factory-boy-b590e5014351a79d66d2f4816b1a6aa83908f395.tar factory-boy-b590e5014351a79d66d2f4816b1a6aa83908f395.tar.gz |
Add PostGenerationDeclarationDict (cf. DeclarationDict).
Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
Diffstat (limited to 'factory')
-rw-r--r-- | factory/containers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/factory/containers.py b/factory/containers.py index b8557d6..9f480cc 100644 --- a/factory/containers.py +++ b/factory/containers.py @@ -149,13 +149,21 @@ class DeclarationDict(dict): Args: extra (dict): additional attributes to include in the copy. """ - new = DeclarationDict() + new = self.__class__() new.update(self) if extra: new.update(extra) return new +class PostGenerationDeclarationDict(DeclarationDict): + """Alternate DeclarationDict for PostGenerationDeclaration.""" + + def is_declaration(self, name, value): + """Captures instances of PostGenerationDeclaration.""" + return isinstance(value, declarations.PostGenerationDeclaration) + + class LazyValue(object): """Some kind of "lazy evaluating" object.""" |