summaryrefslogtreecommitdiff
path: root/tests/test_declarations.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-04-29 23:00:32 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-04-29 23:02:08 +0200
commit38dfde05f5be3cdd69e6fee66e7968b776b0ed9f (patch)
tree7b4ba1cec98b002150f372e351aefff58ec7ef4d /tests/test_declarations.py
parent3b75e132fd1f302b604e76f4c1a0361c32ba50d4 (diff)
downloadfactory-boy-38dfde05f5be3cdd69e6fee66e7968b776b0ed9f.tar
factory-boy-38dfde05f5be3cdd69e6fee66e7968b776b0ed9f.tar.gz
declarations: Rename RelatedFactory.name (See #58).
Use less conflict-prone factory_related_name. Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests/test_declarations.py')
-rw-r--r--tests/test_declarations.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_declarations.py b/tests/test_declarations.py
index 4c08dfa..90e54c2 100644
--- a/tests/test_declarations.py
+++ b/tests/test_declarations.py
@@ -210,6 +210,17 @@ class RelatedFactoryTestCase(unittest.TestCase):
# IMPORTANT: restore attribute.
datetime.date = orig_date
+ def test_deprecate_name(self):
+ with warnings.catch_warnings(record=True) as w:
+
+ warnings.simplefilter('always')
+ f = declarations.RelatedFactory('datetime.date', name='blah')
+
+ self.assertEqual('blah', f.name)
+ self.assertEqual(1, len(w))
+ self.assertIn('RelatedFactory', str(w[0].message))
+ self.assertIn('factory_related_name', str(w[0].message))
+
class PostGenerationMethodCallTestCase(unittest.TestCase):
def setUp(self):