From 9269db983d847be7a0cdc9eb2bcc4ebe3066be1c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 00:23:33 +0100 Subject: python/ldb: Add __getitem__ implementation for LdbMessageElement. (This used to be commit e6498a0780dd31dfc623a69432004b606aeaccbe) --- source4/lib/ldb/tests/python/api.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/lib/ldb/tests/python') diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index d9dfce8718..0a5ba035ff 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -382,6 +382,12 @@ class MessageElementTests(unittest.TestCase): x = ldb.MessageElement(["foo"]) self.assertEquals(["foo"], list(x)) + def test_get_item(self): + x = ldb.MessageElement(["foo", "bar"]) + self.assertEquals("foo", x[0]) + self.assertEquals("bar", x[1]) + self.assertRaises(KeyError, lambda: x[-1]) + class ExampleModule: name = "example" -- cgit