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/.
12 from testcollections_base
import CollectionsTestBase
15 # Miscellaneous tests of the behaviour of UNO objects using the new-style
16 # collection accessors
18 class TestMisc(CollectionsTestBase
):
21 # for val in obj: ... # Implicit iterator
24 def test_misc_IterateInvalidType(self
):
26 doc
= self
.createBlankTextDocument()
29 with self
.assertRaises(TypeError):
30 for val
in doc
.UIConfigurationManager
:
36 # if val in itr: ... # Test value presence
39 def test_misc_InInvalidType(self
):
41 doc
= self
.createBlankTextDocument()
44 with self
.assertRaises(TypeError):
45 _
= "bar" in doc
.UIConfigurationManager
50 # num = len(obj) # Number of elements
53 def test_misc_LenInvalidType(self
):
55 doc
= self
.createBlankTextDocument()
58 with self
.assertRaises(TypeError):
59 len(doc
.UIConfigurationManager
)
64 # val = obj[0] # Access by index
67 def test_misc_SubscriptInvalidType(self
):
69 doc
= self
.createBlankTextDocument()
72 with self
.assertRaises(TypeError):
73 doc
.UIConfigurationManager
[0]
78 if __name__
== '__main__':
81 # vim:set shiftwidth=4 softtabstop=4 expandtab: