mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-31 21:40:24 +00:00
Merge pull request #201 from andrewsmedina/get_attr_tests
Added more tests for get_attr templatetag.
This commit is contained in:
commit
5c26287100
1 changed files with 22 additions and 0 deletions
|
|
@ -74,3 +74,25 @@ class TagsTests(TestCase):
|
|||
admin2_tags.get_attr(Klass(), "hello"),
|
||||
"hello"
|
||||
)
|
||||
|
||||
def test_get_attr_str(self):
|
||||
class Klass(object):
|
||||
def __str__(self):
|
||||
return "str"
|
||||
|
||||
def __unicode__(self):
|
||||
return "unicode"
|
||||
|
||||
self.assertEquals(
|
||||
admin2_tags.get_attr(Klass(), "__str__"),
|
||||
"unicode"
|
||||
)
|
||||
|
||||
def test_get_attr(self):
|
||||
class Klass(object):
|
||||
attr = "value"
|
||||
|
||||
self.assertEquals(
|
||||
admin2_tags.get_attr(Klass(), "attr"),
|
||||
"value"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue