Skip to content
Snippets Groups Projects
Verified Commit f2d12dfb authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add tests for get_dict.

parent 434a8ae3
No related branches found
No related tags found
No related merge requests found
from biscuit.core.templatetags.data_helpers import get_dict
def test_get_dict_object():
class _Foo(object):
bar = 12
assert _Foo.bar == get_dict(_Foo, 'bar')
def test_get_dict_dict():
_foo = {'bar': 12}
assert _foo['bar'] == get_dict(_foo, 'bar')
def test_get_dict_list():
_foo = [10, 11, 12]
assert _foo[2] == get_dict(_foo, 2)
def test_get_dict_invalid():
_foo = 12
assert get_dict(_foo, 'bar') is None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment