Last active
December 20, 2015 23:19
-
-
Save loic/6211798 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python3 ./tests/runtests.py model_inheritance_regress | |
Creating test database for alias 'default'... | |
Creating test database for alias 'other'... | |
E.....x.F............ | |
====================================================================== | |
ERROR: test_abstract_base_class_m2m_relation_inheritance (model_inheritance_regress.tests.ModelInheritanceTest) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/Users/loic/Dev/django/tests/model_inheritance_regress/tests.py", line 386, in test_abstract_base_class_m2m_relation_inheritance | |
messy_parent = messy.bachelorparty_ptr | |
AttributeError: 'BachelorParty' object has no attribute 'bachelorparty_ptr' | |
====================================================================== | |
FAIL: test_inherited_manager (model_inheritance_regress.tests.ModelInheritanceTest) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/Users/loic/Dev/django/tests/model_inheritance_regress/tests.py", line 281, in test_inherited_manager | |
self.assertFalse(hasattr(MessyBachelorParty, 'event_manager')) | |
AssertionError: True is not false | |
---------------------------------------------------------------------- | |
Ran 21 tests in 0.093s | |
FAILED (failures=1, errors=1, expected failures=1) | |
Destroying test database for alias 'default'... | |
Destroying test database for alias 'other'... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/model_inheritance_regress/models.py b/tests/model_inheritance_regress/models.py | |
index 0f45a2c..16bdcf8 100644 | |
--- a/tests/model_inheritance_regress/models.py | |
+++ b/tests/model_inheritance_regress/models.py | |
@@ -155,6 +155,8 @@ class Person(models.Model): | |
class AbstractEvent(models.Model): | |
name = models.CharField(max_length=100) | |
attendees = models.ManyToManyField(Person, related_name="%(class)s_set") | |
+ objects = models.Manager() | |
+ event_manager = models.Manager() | |
class Meta: | |
abstract = True | |
@@ -164,10 +166,12 @@ class AbstractEvent(models.Model): | |
return self.name | |
class BirthdayParty(AbstractEvent): | |
- pass | |
+ objects = models.Manager() | |
+ birthday_manager = models.Manager() | |
class BachelorParty(AbstractEvent): | |
- pass | |
+ objects = models.Manager() | |
+ bachelor_manager = models.Manager() | |
class MessyBachelorParty(BachelorParty): | |
pass | |
diff --git a/tests/model_inheritance_regress/tests.py b/tests/model_inheritance_regress/tests.py | |
index 7f78fc7..ad0751a 100644 | |
--- a/tests/model_inheritance_regress/tests.py | |
+++ b/tests/model_inheritance_regress/tests.py | |
@@ -268,6 +268,19 @@ class ModelInheritanceTest(TestCase): | |
pos = fragment.find('pub_date') | |
self.assertEqual(fragment.find('pub_date', pos + 1), -1) | |
+ def test_inherited_manager(self): | |
+ self.assertEqual(BirthdayParty._meta.abstract, False) | |
+ self.assertTrue(hasattr(BirthdayParty, 'event_manager')) | |
+ self.assertTrue(hasattr(BirthdayParty, 'birthday_manager')) | |
+ | |
+ self.assertEqual(BachelorParty._meta.abstract, False) | |
+ self.assertTrue(hasattr(BachelorParty, 'event_manager')) | |
+ self.assertTrue(hasattr(BachelorParty, 'bachelor_manager')) | |
+ | |
+ self.assertEqual(MessyBachelorParty._meta.abstract, False) | |
+ self.assertFalse(hasattr(MessyBachelorParty, 'event_manager')) | |
+ self.assertFalse(hasattr(MessyBachelorParty, 'bachelor_manager')) | |
+ | |
def test_queryset_update_on_parent_model(self): | |
""" | |
Regression test for #10362 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment