mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-05-25 15:23:50 +00:00
Added more tests for get_attr templatetag.
This commit is contained in:
parent
edcdb00fbd
commit
27544d5a51
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