diff options
-rw-r--r-- | MANIFEST.in | 6 | ||||
-rw-r--r-- | docs/_static/.keep_dir | 0 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | tests/test_using.py | 19 |
4 files changed, 26 insertions, 1 deletions
diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..3912fee --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include README +include docs/Makefile +recursive-include docs *.py *.rst +include docs/_static/.keep_dir +prune docs/_build +recursive-include tests *.py diff --git a/docs/_static/.keep_dir b/docs/_static/.keep_dir new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/docs/_static/.keep_dir @@ -5,7 +5,7 @@ from distutils.core import setup from distutils import cmd # Remember to change in factory/__init__.py as well! -VERSION = '1.1.2' +VERSION = '1.1.3' class test(cmd.Command): diff --git a/tests/test_using.py b/tests/test_using.py index 41b34ea..7f9f09c 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -780,6 +780,25 @@ class IteratorTestCase(unittest.TestCase): for i, obj in enumerate(objs): self.assertEqual(i % 5, obj.one) + def test_infinite_iterator_list_comprehension(self): + class TestObjectFactory(factory.Factory): + one = factory.InfiniteIterator([j * 3 for j in xrange(5)]) + + # Scope bleeding: j will end up in TestObjectFactory's scope. + + self.assertRaises(TypeError, TestObjectFactory.build) + + def test_infinite_iterator_list_comprehension_protected(self): + class TestObjectFactory(factory.Factory): + one = factory.InfiniteIterator([_j * 3 for _j in xrange(5)]) + + # Scope bleeding : _j will end up in TestObjectFactory's scope. + # But factory_boy ignores it, as a protected variable. + objs = TestObjectFactory.build_batch(20) + + for i, obj in enumerate(objs): + self.assertEqual(3 * (i % 5), obj.one) + def test_iterator_decorator(self): class TestObjectFactory(factory.Factory): @factory.iterator |