diff options
author | Kenneth Koski <mechaxl@gmail.com> | 2016-02-19 19:55:31 -0600 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-02-23 08:14:18 +0000 |
commit | 4f6e3108d9b9b67f21d11d597f2e607acafabd72 (patch) | |
tree | 9318e40b5e1b3a55540efd50ca1db6925433f013 /pyuno | |
parent | 799eab3b3499be5846e13e6360cc01741a241f89 (diff) |
Running pep8 on pyuno unit test files
Change-Id: I5d35305386e1f520d1030776e2b7bcf7620eda04
Reviewed-on: https://gerrit.libreoffice.org/22514
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/qa/pytests/insertremovecells.py | 28 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XCellRange.py | 53 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XEnumeration.py | 2 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XEnumerationAccess.py | 2 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XIndexAccess.py | 22 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XIndexContainer.py | 40 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XIndexReplace.py | 39 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XNameAccess.py | 13 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XNameContainer.py | 10 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_XNameReplace.py | 2 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_base.py | 3 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_misc.py | 2 | ||||
-rw-r--r-- | pyuno/qa/pytests/testcollections_mixednameindex.py | 6 | ||||
-rw-r--r-- | pyuno/qa/pytests/testssl.py | 4 |
14 files changed, 111 insertions, 115 deletions
diff --git a/pyuno/qa/pytests/insertremovecells.py b/pyuno/qa/pytests/insertremovecells.py index 9c521f27cf4d..5c2585ae16e0 100644 --- a/pyuno/qa/pytests/insertremovecells.py +++ b/pyuno/qa/pytests/insertremovecells.py @@ -9,6 +9,7 @@ except ImportError: from org.libreoffice.unotest import pyuno, mkPropertyValue + class InsertRemoveCells(unittest.TestCase): @classmethod @@ -16,10 +17,6 @@ class InsertRemoveCells(unittest.TestCase): cls.xContext = pyuno.getComponentContext() pyuno.private_initTestEnvironment() - - # no need for a tearDown(cls) method. - - def test_fdo74824_load(self): ctxt = self.xContext assert(ctxt) @@ -35,12 +32,12 @@ class InsertRemoveCells(unittest.TestCase): doc = desktop.loadComponentFromURL(url, "_blank", 0, loadProps) sheet = doc.Sheets.Sheet1 - area = sheet.getCellRangeByName( 'A2:B4' ) + area = sheet.getCellRangeByName('A2:B4') addr = area.getRangeAddress() # 2 = intended to shift cells right, but I don't know where to find # the ENUM to put in its place. Corrections welcome. - sheet.insertCells( addr, 2 ) + sheet.insertCells(addr, 2) # basically, the insertCells call is the test: it should not crash # LibreOffice. However, for completeness, we should test the cell @@ -65,21 +62,22 @@ class InsertRemoveCells(unittest.TestCase): ) for pos in empty_cells: cell = sheet.getCellByPosition(*pos) - self.assertEqual( 'EMPTY', cell.Type.value ) + self.assertEqual('EMPTY', cell.Type.value) + for x, y, f, s, val in formula_cells: cell = sheet.getCellByPosition(x, y) - self.assertEqual( 'FORMULA', cell.Type.value ) - self.assertEqual( f, cell.getFormula() ) - self.assertEqual( s, cell.String ) - self.assertEqual( val, cell.Value ) + self.assertEqual('FORMULA', cell.Type.value) + self.assertEqual(f, cell.getFormula()) + self.assertEqual(s, cell.String) + self.assertEqual(val, cell.Value) + for x, y, s, val in value_cells: cell = sheet.getCellByPosition(x, y) - self.assertEqual( s, cell.String ) - self.assertEqual( val, cell.Value ) + self.assertEqual(s, cell.String) + self.assertEqual(val, cell.Value) - doc.close( True ) + doc.close(True) if __name__ == '__main__': unittest.main() - diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py b/pyuno/qa/pytests/testcollections_XCellRange.py index ad8819b0b869..871f92d3aaed 100644 --- a/pyuno/qa/pytests/testcollections_XCellRange.py +++ b/pyuno/qa/pytests/testcollections_XCellRange.py @@ -33,7 +33,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - cell = sht[0,0] + cell = sht[0, 0] # Then self.assertEqual(0, cell.CellAddress.Sheet) @@ -49,13 +49,13 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) # When - cell = tbl[0,0] + cell = tbl[0, 0] # Then self.assertEqual('A1', cell.CellName) @@ -71,7 +71,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[3,7] + rng = sht[3, 7] # Then self.assertEqual(0, rng.CellAddress.Sheet) @@ -87,13 +87,13 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) # When - cell = tbl[3,7] + cell = tbl[3, 7] # Then self.assertEqual('H4', cell.CellName) @@ -108,7 +108,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[0,1:3] + rng = sht[0, 1:3] # Then self.assertEqual(0, rng.RangeAddress.Sheet) @@ -125,16 +125,16 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) doc.lockControllers() - tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x,10*x + 10)) for x in range(10)) + tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10)) doc.unlockControllers() # When - rng = tbl[0,1:3] + rng = tbl[0, 1:3] # Then self.assertEqual((('101', '102'),), rng.DataArray) @@ -149,7 +149,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[1:3,0] + rng = sht[1:3, 0] # Then self.assertEqual(0, rng.RangeAddress.Sheet) @@ -166,16 +166,16 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) doc.lockControllers() - tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x,10*x + 10)) for x in range(10)) + tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10)) doc.unlockControllers() # When - rng = tbl[1:3,0] + rng = tbl[1:3, 0] # Then self.assertEqual((('110',), ('120',)), rng.DataArray) @@ -190,7 +190,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[1:3,3:5] + rng = sht[1:3, 3:5] # Then self.assertEqual(0, rng.RangeAddress.Sheet) @@ -211,9 +211,9 @@ class TestXCellRange(CollectionsTestBase): # When / Then with self.assertRaises(KeyError): - rng = sht[1:1,3:5] + rng = sht[1:1, 3:5] with self.assertRaises(KeyError): - rng = sht[1:3,3:3] + rng = sht[1:3, 3:3] # Tests syntax: # rng = cellrange[0:1,2:3] # Access cell range by slices @@ -223,21 +223,20 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) doc.lockControllers() - tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x,10*x + 10)) for x in range(10)) + tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10)) doc.unlockControllers() # When - rng = tbl[1:3,3:5] + rng = tbl[1:3, 3:5] # Then self.assertEqual((('113', '114'), ('123', '124')), rng.DataArray) - # Tests syntax: # rng = cellrange['A1:B2'] # Access cell range by descriptor # For: @@ -265,12 +264,12 @@ class TestXCellRange(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance('com.sun.star.text.TextTable') - textTable.initialize(10,10) + textTable.initialize(10, 10) cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) tbl = doc.TextTables.getByIndex(0) doc.lockControllers() - tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x,10*x + 10)) for x in range(10)) + tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10)) doc.unlockControllers() # When @@ -288,7 +287,7 @@ class TestXCellRange(CollectionsTestBase): spr = self.createBlankSpreadsheet() sht = spr.Sheets.getByIndex(0) expr = '$' + sht.Name + '.$C2:F10' - addr = CellAddress(Sheet=0,Row=1,Column=2) + addr = CellAddress(Sheet=0, Row=1, Column=2) sht.NamedRanges.addNewByName('foo', expr, addr, 0) # When @@ -330,7 +329,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[0,:] + rng = sht[0, :] # Then self.assertEqual(0, rng.RangeAddress.Sheet) @@ -349,7 +348,7 @@ class TestXCellRange(CollectionsTestBase): sht = spr.Sheets.getByIndex(0) # When - rng = sht[:,0] + rng = sht[:, 0] # Then self.assertEqual(0, rng.RangeAddress.Sheet) @@ -362,4 +361,4 @@ class TestXCellRange(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XEnumeration.py b/pyuno/qa/pytests/testcollections_XEnumeration.py index 9be1a60b9985..6edc77f44952 100644 --- a/pyuno/qa/pytests/testcollections_XEnumeration.py +++ b/pyuno/qa/pytests/testcollections_XEnumeration.py @@ -108,4 +108,4 @@ class TestXEnumeration(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py index 1ad7a08f31fa..dc5a52f54537 100644 --- a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py +++ b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py @@ -128,4 +128,4 @@ class TestXEnumerationAccess(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XIndexAccess.py b/pyuno/qa/pytests/testcollections_XIndexAccess.py index 753373b6b933..9a44811bc2be 100644 --- a/pyuno/qa/pytests/testcollections_XIndexAccess.py +++ b/pyuno/qa/pytests/testcollections_XIndexAccess.py @@ -120,8 +120,8 @@ class TestXIndexAccess(CollectionsTestBase): self.readValuesTestFixture(doc, 0, None, TypeError) self.readValuesTestFixture(doc, 0, 'foo', TypeError) self.readValuesTestFixture(doc, 0, 12.34, TypeError) - self.readValuesTestFixture(doc, 0, (0,1), TypeError) - self.readValuesTestFixture(doc, 0, [0,1], TypeError) + self.readValuesTestFixture(doc, 0, (0, 1), TypeError) + self.readValuesTestFixture(doc, 0, [0, 1], TypeError) self.readValuesTestFixture(doc, 0, {'a': 'b'}, TypeError) # Tests syntax: @@ -131,9 +131,9 @@ class TestXIndexAccess(CollectionsTestBase): testMax = 4 for i in range(testMax): t = tuple(range(i)) - for j in [x for x in range(-testMax-2,testMax+3)] + [None]: - for k in [x for x in range(-testMax-2,testMax+3)] + [None]: - key = slice(j,k) + for j in [x for x in range(-testMax-2, testMax+3)] + [None]: + for k in [x for x in range(-testMax-2, testMax+3)] + [None]: + key = slice(j, k) expected = t[key] self.readValuesTestFixture(doc, i, key, expected) @@ -144,10 +144,10 @@ class TestXIndexAccess(CollectionsTestBase): testMax = 4 for i in range(testMax): t = tuple(range(i)) - for j in [x for x in range(-testMax-2,testMax+3)] + [None]: - for k in [x for x in range(-testMax-2,testMax+3)] + [None]: - for l in [-2,-1,2]: - key = slice(j,k,l) + for j in [x for x in range(-testMax-2, testMax+3)] + [None]: + for k in [x for x in range(-testMax-2, testMax+3)] + [None]: + for l in [-2, -1, 2]: + key = slice(j, k, l) expected = t[key] self.readValuesTestFixture(doc, i, key, expected) @@ -162,7 +162,7 @@ class TestXIndexAccess(CollectionsTestBase): footnote = doc.createInstance("com.sun.star.text.Footnote") footnote.setLabel('foo') doc.Text.insertTextContent(cursor, footnote, 0) - footnote = doc.Footnotes.getByIndex(0); + footnote = doc.Footnotes.getByIndex(0) # When present = footnote in doc.Footnotes @@ -296,4 +296,4 @@ class TestXIndexAccess(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XIndexContainer.py b/pyuno/qa/pytests/testcollections_XIndexContainer.py index aad9b848b841..b25a17b8ec87 100644 --- a/pyuno/qa/pytests/testcollections_XIndexContainer.py +++ b/pyuno/qa/pytests/testcollections_XIndexContainer.py @@ -26,7 +26,7 @@ class TestXIndexContainer(CollectionsTestBase): values = sm.createInstanceWithContext("com.sun.star.document.IndexedPropertyValues", self.context) for i in range(count): properties = (PropertyValue(Name='n'+str(i), Value='v'+str(i)),) - uno.invoke (values, "insertByIndex", (i, uno.Any("[]com.sun.star.beans.PropertyValue", properties))) + uno.invoke(values, "insertByIndex", (i, uno.Any("[]com.sun.star.beans.PropertyValue", properties))) return values def generateTestTuple(self, values): @@ -89,7 +89,6 @@ class TestXIndexContainer(CollectionsTestBase): for i in range(propertyValues.getCount()): self.assertEqual(toCompare[i][0].Name, propertyValues.getByIndex(i)[0].Name) - # Tests syntax: # obj[2:4] = val1,val2 # Replace by slice # obj[2:3] = val1,val2 # Insert/replace by slice @@ -102,9 +101,9 @@ class TestXIndexContainer(CollectionsTestBase): baseMax = 5 assignMax = 5 for i in range(baseMax): - for j in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - for k in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - key = slice(j,k) + for j in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + for k in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + key = slice(j, k) for l in range(assignMax): assign = [y+100 for y in range(l)] expected = list(range(i)) @@ -119,12 +118,12 @@ class TestXIndexContainer(CollectionsTestBase): # Cases not requiring sequence type coercion # Invalid values def test_XIndexContainer_AssignSlice_Invalid(self): - self.assignValuesTestFixture(2, slice(0,2), None, TypeError()) - self.assignValuesTestFixture(2, slice(0,2), 'foo', TypeError()) - self.assignValuesTestFixture(2, slice(0,2), 12.34, TypeError()) - self.assignValuesTestFixture(2, slice(0,2), {'a':'b'}, TypeError()) - self.assignValuesTestFixture(2, slice(0,2), ('foo',), TypeError()) - self.assignValuesTestFixture(2, slice(0,2), ('foo','foo'), TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), None, TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), 'foo', TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), 12.34, TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), {'a': 'b'}, TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), ('foo',), TypeError()) + self.assignValuesTestFixture(2, slice(0, 2), ('foo', 'foo'), TypeError()) # Tests syntax: # obj[2:2] = (val,) # Insert by slice @@ -150,10 +149,10 @@ class TestXIndexContainer(CollectionsTestBase): baseMax = 5 assignMax = 5 for i in range(baseMax): - for j in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - for k in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - for l in [-2,-1,1,2]: - key = slice(j,k,l) + for j in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + for k in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + for l in [-2, -1, 1, 2]: + key = slice(j, k, l) for m in range(assignMax): assign = [y+100 for y in range(m)] expected = list(range(i)) @@ -161,6 +160,7 @@ class TestXIndexContainer(CollectionsTestBase): expected[key] = assign except Exception as e: expected = e + self.assignValuesTestFixture(i, key, assign, expected) # Tests syntax: @@ -168,7 +168,7 @@ class TestXIndexContainer(CollectionsTestBase): def test_XIndexContainer_DelIndex(self): baseMax = 5 for i in range(baseMax): - for j in [x for x in range(-baseMax-2,baseMax+3)]: + for j in [x for x in range(-baseMax-2, baseMax+3)]: expected = list(range(i)) try: del expected[j] @@ -181,9 +181,9 @@ class TestXIndexContainer(CollectionsTestBase): def test_XIndexContainer_DelSlice(self): baseMax = 5 for i in range(baseMax): - for j in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - for k in [x for x in range(-baseMax-2,baseMax+3)] + [None]: - key = slice(j,k) + for j in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + for k in [x for x in range(-baseMax-2, baseMax+3)] + [None]: + key = slice(j, k) expected = list(range(i)) try: del expected[key] @@ -195,4 +195,4 @@ class TestXIndexContainer(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XIndexReplace.py b/pyuno/qa/pytests/testcollections_XIndexReplace.py index b8e0da59326e..d545a5cc8fa1 100644 --- a/pyuno/qa/pytests/testcollections_XIndexReplace.py +++ b/pyuno/qa/pytests/testcollections_XIndexReplace.py @@ -22,10 +22,10 @@ from com.sun.star.beans import PropertyValue class TestXIndexReplace(CollectionsTestBase): def generateTestContentIndex(self, doc): - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") for i in range(10): styles = ('n'+str(i),) - uno.invoke (index.LevelParagraphStyles, "replaceByIndex", (i, uno.Any("[]string", styles))) + uno.invoke(index.LevelParagraphStyles, "replaceByIndex", (i, uno.Any("[]string", styles))) return index def generateTestTuple(self, values): @@ -59,7 +59,6 @@ class TestXIndexReplace(CollectionsTestBase): for i in range(10): self.assertEqual(toCompare[i][0], index.LevelParagraphStyles.getByIndex(i)[0]) - # Tests syntax: # obj[0] = val # Replace by index # For: @@ -67,7 +66,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When index.LevelParagraphStyles[0] = ('Caption',) @@ -82,7 +81,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_None(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -95,7 +94,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_String(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -108,7 +107,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_Float(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -121,11 +120,11 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_List(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): - index.LevelParagraphStyles[0] = [0,1] + index.LevelParagraphStyles[0] = [0, 1] # Tests syntax: # obj[0] = val # Replace by index @@ -134,7 +133,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_Dict(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -147,7 +146,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceIndex_Invalid_InconsistentTuple(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -161,9 +160,9 @@ class TestXIndexReplace(CollectionsTestBase): assignMax = 12 doc = self.createBlankTextDocument() t = tuple(range(10)) - for j in [x for x in range(-12,13)] + [None]: - for k in [x for x in range(-12,13)] + [None]: - key = slice(j,k) + for j in [x for x in range(-12, 13)] + [None]: + for k in [x for x in range(-12, 13)] + [None]: + key = slice(j, k) for l in range(assignMax): assign = [y+100 for y in range(l)] expected = list(range(10)) @@ -182,7 +181,7 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceSlice_Invalid_InconsistentTuple(self): # Given doc = self.createBlankTextDocument() - index = doc.createInstance("com.sun.star.text.ContentIndex"); + index = doc.createInstance("com.sun.star.text.ContentIndex") # When / Then with self.assertRaises(TypeError): @@ -199,10 +198,10 @@ class TestXIndexReplace(CollectionsTestBase): assignMax = 12 doc = self.createBlankTextDocument() t = tuple(range(10)) - for j in [x for x in range(-12,13)] + [None]: - for k in [x for x in range(-12,13)] + [None]: - for l in [-2,-1,2]: - key = slice(j,k,l) + for j in [x for x in range(-12, 13)] + [None]: + for k in [x for x in range(-12, 13)] + [None]: + for l in [-2, -1, 2]: + key = slice(j, k, l) for m in range(assignMax): assign = [y+100 for y in range(m)] expected = list(range(10)) @@ -216,4 +215,4 @@ class TestXIndexReplace(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XNameAccess.py b/pyuno/qa/pytests/testcollections_XNameAccess.py index f123641fc324..26485602cb75 100644 --- a/pyuno/qa/pytests/testcollections_XNameAccess.py +++ b/pyuno/qa/pytests/testcollections_XNameAccess.py @@ -30,7 +30,7 @@ class TestXNameAccess(CollectionsTestBase): drw = self.createBlankDrawing() # When - length = len (drw.Links) + length = len(drw.Links) # Then self.assertEqual(2, length) @@ -96,7 +96,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[(1,2)] + link = drw.Links[(1, 2)] # Tests syntax: # val = obj[key] # Access by key @@ -108,7 +108,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[[1,2]] + link = drw.Links[[1, 2]] # Tests syntax: # val = obj[key] # Access by key @@ -120,7 +120,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[{'a':'b'}] + link = drw.Links[{'a': 'b'}] # Tests syntax: # if key in obj: ... # Test key presence @@ -137,7 +137,6 @@ class TestXNameAccess(CollectionsTestBase): # Then self.assertTrue(present) - # Tests syntax: # for key in obj: ... # Implicit iterator (keys) # For: @@ -156,7 +155,7 @@ class TestXNameAccess(CollectionsTestBase): readLinks.append(link) # Then - self.assertEqual(['foo0','foo1'], readLinks) + self.assertEqual(['foo0', 'foo1'], readLinks) # Tests syntax: # itr = iter(obj) # Named iterator (keys) @@ -179,4 +178,4 @@ class TestXNameAccess(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XNameContainer.py b/pyuno/qa/pytests/testcollections_XNameContainer.py index 80b60465882d..8838516fdd15 100644 --- a/pyuno/qa/pytests/testcollections_XNameContainer.py +++ b/pyuno/qa/pytests/testcollections_XNameContainer.py @@ -29,7 +29,7 @@ class TestXNameContainer(CollectionsTestBase): # Given spr = self.createBlankSpreadsheet() ranges = spr.createInstance("com.sun.star.sheet.SheetCellRanges") - newRange = spr.Sheets.getByIndex(0).getCellRangeByPosition( 1, 2, 1, 2 ) + newRange = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2) # When ranges['foo'] = newRange @@ -45,7 +45,7 @@ class TestXNameContainer(CollectionsTestBase): # Given spr = self.createBlankSpreadsheet() ranges = spr.createInstance("com.sun.star.sheet.SheetCellRanges") - newRange = spr.Sheets.getByIndex(0).getCellRangeByPosition( 1, 2, 1, 2 ) + newRange = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2) # When / Then with self.assertRaises(TypeError): @@ -57,8 +57,8 @@ class TestXNameContainer(CollectionsTestBase): # Given spr = self.createBlankSpreadsheet() ranges = spr.createInstance("com.sun.star.sheet.SheetCellRanges") - newRange1 = spr.Sheets.getByIndex(0).getCellRangeByPosition( 1, 2, 1, 2 ) - newRange2 = spr.Sheets.getByIndex(0).getCellRangeByPosition( 6, 6, 6, 6 ) + newRange1 = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2) + newRange2 = spr.Sheets.getByIndex(0).getCellRangeByPosition(6, 6, 6, 6) # When ranges['foo'] = newRange1 @@ -113,4 +113,4 @@ class TestXNameContainer(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_XNameReplace.py b/pyuno/qa/pytests/testcollections_XNameReplace.py index 622311433c41..e8a405146094 100644 --- a/pyuno/qa/pytests/testcollections_XNameReplace.py +++ b/pyuno/qa/pytests/testcollections_XNameReplace.py @@ -70,4 +70,4 @@ class TestXNameReplace(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_base.py b/pyuno/qa/pytests/testcollections_base.py index 2efb6f4a7578..8db14189f149 100644 --- a/pyuno/qa/pytests/testcollections_base.py +++ b/pyuno/qa/pytests/testcollections_base.py @@ -13,6 +13,7 @@ import uno from org.libreoffice.unotest import pyuno from com.sun.star.beans import PropertyValue + class CollectionsTestBase(unittest.TestCase): @classmethod @@ -55,4 +56,4 @@ class CollectionsTestBase(unittest.TestCase): self._components.append(component) return component -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_misc.py b/pyuno/qa/pytests/testcollections_misc.py index c66f6f440598..04dcf595931a 100644 --- a/pyuno/qa/pytests/testcollections_misc.py +++ b/pyuno/qa/pytests/testcollections_misc.py @@ -72,4 +72,4 @@ class TestMisc(CollectionsTestBase): if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testcollections_mixednameindex.py b/pyuno/qa/pytests/testcollections_mixednameindex.py index cf4c9e18e7ba..ac28f1032227 100644 --- a/pyuno/qa/pytests/testcollections_mixednameindex.py +++ b/pyuno/qa/pytests/testcollections_mixednameindex.py @@ -27,7 +27,7 @@ class TestMixedNameIndex(CollectionsTestBase): # Given doc = self.createBlankTextDocument() textTable = doc.createInstance("com.sun.star.text.TextTable") - textTable.initialize(2,2) + textTable.initialize(2, 2) textTable.Name = 'foo' cursor = doc.Text.createTextCursor() doc.Text.insertTextContent(cursor, textTable, False) @@ -39,10 +39,10 @@ class TestMixedNameIndex(CollectionsTestBase): # Then self.assertEqual('foo', tableByName.Name) self.assertEqual('foo', tableByIndex.Name) - self.assertEqual(tableByName,tableByIndex) + self.assertEqual(tableByName, tableByIndex) if __name__ == '__main__': unittest.main() -# vim:set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/pyuno/qa/pytests/testssl.py b/pyuno/qa/pytests/testssl.py index f0a0a37fc88b..6ec9875fb84f 100644 --- a/pyuno/qa/pytests/testssl.py +++ b/pyuno/qa/pytests/testssl.py @@ -1,10 +1,10 @@ import unittest -#I want to ensure that import ssl works on all platforms + +# I want to ensure that import ssl works on all platforms class SSLTest(unittest.TestCase): def test_ssl_import(self): import ssl if __name__ == '__main__': unittest.main() - |