Skip to content

Commit

Permalink
Added a test case for the subclass accessor key error.
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed Jan 22, 2016
1 parent 45122c9 commit e7f624d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,19 @@ class Meta:
self.assertEqual(DynamicChild.accessors, {
DynamicChild: EMPTY_ACCESSOR,
})

def test_key_error(self):
test_apps = Apps(['tests'])

class Base(models.Model):
class Meta:
apps = test_apps

accessors = SubclassAccessors()

class Other(models.Model):
class Meta:
apps = test_apps

with self.assertRaises(KeyError):
Base.accessors['tests', 'other']

0 comments on commit e7f624d

Please sign in to comment.