3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 from testcollections_base
import CollectionsTestBase
14 from com
.sun
.star
.beans
import PropertyValue
17 # Miscellaneous tests of the behaviour of UNO objects using the new-style
18 # collection accessors
20 class TestMisc(CollectionsTestBase
):
23 # for val in obj: ... # Implicit iterator
26 def test_misc_IterateInvalidType(self
):
28 doc
= self
.createBlankTextDocument()
31 with self
.assertRaises(TypeError):
32 for val
in doc
.UIConfigurationManager
:
38 # if val in itr: ... # Test value presence
41 def test_misc_InInvalidType(self
):
43 doc
= self
.createBlankTextDocument()
46 with self
.assertRaises(TypeError):
47 foo
= "bar" in doc
.UIConfigurationManager
52 # num = len(obj) # Number of elements
55 def test_misc_LenInvalidType(self
):
57 doc
= self
.createBlankTextDocument()
60 with self
.assertRaises(TypeError):
61 len(doc
.UIConfigurationManager
)
66 # val = obj[0] # Access by index
69 def test_misc_SubscriptInvalidType(self
):
71 doc
= self
.createBlankTextDocument()
74 with self
.assertRaises(TypeError):
75 doc
.UIConfigurationManager
[0]
80 if __name__
== '__main__':
83 # vim:set shiftwidth=4 softtabstop=4 expandtab: