Commit 59283fcb by Chris Jerdonek

Added a unit test case for issue #11.

We added a case to check that callable return values of __getitem__
are not called.  There is already a test that callable attributes
are called: test_object__attribute_is_callable().
parent c50f77b8
......@@ -69,6 +69,18 @@ class GetItemTestCase(TestCase):
obj = {"foo": "bar"}
self.assertEquals(_get_item(obj, "foo"), "bar")
def test_dictionary__callable_not_called(self):
"""
Test that callable values are returned as-is (and in particular not called).
"""
def foo_callable(self):
return "bar"
obj = {"foo": foo_callable}
self.assertNotEquals(_get_item(obj, "foo"), "bar")
self.assertTrue(_get_item(obj, "foo") is foo_callable)
def test_dictionary__key_missing(self):
"""
Test getting a missing key from a dictionary.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment