diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-08-16 17:29:59 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-08-16 22:38:42 +0200 |
commit | c34d01278bd9cadff3f1ebea4579ef556cf75480 (patch) | |
tree | 730d40aed20ad27e665329cd34694a7cdc5861d2 /tests/cyclic/bar.py | |
parent | bab73174ff9c6c8ef4bfa24142d18f04411cb342 (diff) | |
download | factory-boy-c34d01278bd9cadff3f1ebea4579ef556cf75480.tar factory-boy-c34d01278bd9cadff3f1ebea4579ef556cf75480.tar.gz |
Add full tests for CircularSubFactory.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests/cyclic/bar.py')
-rw-r--r-- | tests/cyclic/bar.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/cyclic/bar.py b/tests/cyclic/bar.py new file mode 100644 index 0000000..cc90930 --- /dev/null +++ b/tests/cyclic/bar.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2011-2012 Raphaël Barrois +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Helper to test circular factory dependencies.""" + +import factory + +class Bar(object): + def __init__(self, foo, y): + self.foo = foo + self.y = y + + +class BarFactory(factory.Factory): + FACTORY_FOR = Bar + + y = 13 + foo = factory.CircularSubFactory('cyclic.foo', 'FooFactory') + |