Skip to content

Commit

Permalink
Added a test for Model._meta._property_names.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored and timgraham committed Jun 5, 2017
1 parent 0a66aa1 commit 36f09c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/model_meta/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class AbstractPerson(models.Model):
class Meta:
abstract = True

@property
def test_property(self):
return 1


class BasePerson(AbstractPerson):
# DATA fields
Expand Down
5 changes: 5 additions & 0 deletions tests/model_meta/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,8 @@ def test_get_parent_list(self):
self.assertEqual(FirstParent._meta.get_parent_list(), [CommonAncestor])
self.assertEqual(SecondParent._meta.get_parent_list(), [CommonAncestor])
self.assertEqual(Child._meta.get_parent_list(), [FirstParent, SecondParent, CommonAncestor])


class PropertyNamesTests(SimpleTestCase):
def test_person(self):
self.assertEqual(AbstractPerson._meta._property_names, frozenset(['pk', 'test_property']))

0 comments on commit 36f09c8

Please sign in to comment.