tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / pyuno / qa / pytests / testcollections_misc.py
blobe32815840749ad3a405baf6fb6ceb91556b68e4b
1 #!/usr/bin/env python
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/.
10 import unittest
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):
20 # Tests syntax:
21 # for val in obj: ... # Implicit iterator
22 # For:
23 # Invalid type
24 def test_misc_IterateInvalidType(self):
25 # Given
26 doc = self.createBlankTextDocument()
28 # When / Then
29 with self.assertRaises(TypeError):
30 for val in doc.UIConfigurationManager:
31 pass
33 doc.close(True)
35 # Tests syntax:
36 # if val in itr: ... # Test value presence
37 # For:
38 # Invalid type
39 def test_misc_InInvalidType(self):
40 # Given
41 doc = self.createBlankTextDocument()
43 # When / Then
44 with self.assertRaises(TypeError):
45 _ = "bar" in doc.UIConfigurationManager
47 doc.close(True)
49 # Tests syntax:
50 # num = len(obj) # Number of elements
51 # For:
52 # Invalid type
53 def test_misc_LenInvalidType(self):
54 # Given
55 doc = self.createBlankTextDocument()
57 # When / Then
58 with self.assertRaises(TypeError):
59 len(doc.UIConfigurationManager)
61 doc.close(True)
63 # Tests syntax:
64 # val = obj[0] # Access by index
65 # For:
66 # Invalid type
67 def test_misc_SubscriptInvalidType(self):
68 # Given
69 doc = self.createBlankTextDocument()
71 # When / Then
72 with self.assertRaises(TypeError):
73 doc.UIConfigurationManager[0]
75 doc.close(True)
78 if __name__ == '__main__':
79 unittest.main()
81 # vim:set shiftwidth=4 softtabstop=4 expandtab: